diff options
author | Mingming Cao <cmm@us.ibm.com> | 2008-07-11 19:27:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 19:27:31 -0400 |
commit | 3e3398a08d6e516675d5af853d625dc7dd90eab1 (patch) | |
tree | d8a37dbaea105cd36e02827b057a0f9fcad62adc /fs/ext4/file.c | |
parent | 632eaeab1feb5d78c1e2bfb1d2dfc0ebb8ac187f (diff) |
ext4: delayed allocation i_blocks fix for stat
Right now i_blocks is not getting updated until the blocks are actually
allocaed on disk. This means with delayed allocation, right after files
are copied, "ls -sF" shoes the file as taking 0 blocks on disk. "du"
also shows the files taking zero space, which is highly confusing to the
user.
Since delayed allocation already keeps track of per-inode total
number of blocks that are subject to delayed allocation, this patch fix
this by using that to adjust the value returned by stat(2). When real
block allocation is done, the i_blocks will get updated. Since the
reserved blocks for delayed allocation will be decreased, this will be
keep value returned by stat(2) consistent.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r-- | fs/ext4/file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index b9510ba66a2d..430eb7978db4 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -161,6 +161,7 @@ const struct file_operations ext4_file_operations = { | |||
161 | const struct inode_operations ext4_file_inode_operations = { | 161 | const struct inode_operations ext4_file_inode_operations = { |
162 | .truncate = ext4_truncate, | 162 | .truncate = ext4_truncate, |
163 | .setattr = ext4_setattr, | 163 | .setattr = ext4_setattr, |
164 | .getattr = ext4_getattr, | ||
164 | #ifdef CONFIG_EXT4DEV_FS_XATTR | 165 | #ifdef CONFIG_EXT4DEV_FS_XATTR |
165 | .setxattr = generic_setxattr, | 166 | .setxattr = generic_setxattr, |
166 | .getxattr = generic_getxattr, | 167 | .getxattr = generic_getxattr, |