[btrfs-devel]i_blocks and delay allocation

Yan Zheng yanzheng at 21cn.com
Wed Sep 19 06:52:31 PDT 2007


Hello

I found that after defrag a file, the corresponding inode's i_blocks
become incorrect.  I hope
following description address the real reason.

i_blocks is decreased in 'btrfs_drop_extents' when something are
drop/truncated and 'run_delalloc_range' calls 'btrfs_drop_extents' at
first place, so 'run_delalloc_range' may decrease the i_blocks.
('btrfs_drop_extents' doesn't increase i_blocks).   In normal write
operation, i_blocks is increased in advance in
'dirty_and_release_pages', then decreased in 'run_delalloc_range' , so
final result is correct. But when do file defrag or mmap write,
i_blocks is only decreased by  'run_delalloc_range',  i_blocks may
underflow quickly.

Regards
YZ



More information about the Btrfs-devel mailing list