[btrfs-devel][patch]fix for btrfs_truncate_in_trans

Yan Zheng yanzheng at 21cn.com
Tue Sep 18 06:31:54 PDT 2007


2007/9/18, Chris Mason <chris.mason at oracle.com>:
> >
> > Thanks for the clarification
> >
> > Yes, I'm wrong.  But during test the non-exist bug, I have a new
> > discovery. It's seem there is a race between the truncate operation
> > and the delay allocation.  The output of 'ls -s' looks strange, when
> > the truncate operation is before allocation really happen.
> >
> Odd, the i_blocks changes happen inside file_write, not at delalloc
> time.  Could you please try to narrow the problem down?
> -chris
>
When allocation doesn't really happen, there is no extent item. So
btrfs_truncate_in_trans finds nothing and i_blocks isn't updated.

following is  the output of my test.
[yz at yz-bc22ed btrfs]$ dd if=/dev/zero bs=1M count=1 of=test; sync;
>test; ls -s test
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0104944 s, 99.9 MB/s
0 test
[yz at yz-bc22ed btrfs]$ dd if=/dev/zero bs=1M count=1 of=test; >test;
sync; ls -s test
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00260587 s, 402 MB/s
1024 test

Regards
YZ



More information about the Btrfs-devel mailing list