Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96607551 authored by Tao Ma's avatar Tao Ma Committed by Theodore Ts'o
Browse files

ext4: let getattr report the right blocks in delalloc+bigalloc



In delayed allocation, i_reserved_data_blocks now indicates
clusters, not blocks. So report it in the right number.

This can be easily exposed by the following command:
echo foo > blah; du -hc blah; sync; du -hc blah

Reported-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarTao Ma <boyu.mt@taobao.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent f3fc0210
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -4301,7 +4301,8 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
	 * will return the blocks that include the delayed allocation
	 * will return the blocks that include the delayed allocation
	 * blocks for this file.
	 * blocks for this file.
	 */
	 */
	delalloc_blocks = EXT4_I(inode)->i_reserved_data_blocks;
	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
				EXT4_I(inode)->i_reserved_data_blocks);


	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
	return 0;
	return 0;