summaryrefslogtreecommitdiff
path: root/e2fsck/pass3.c
diff options
context:
space:
mode:
authorEric Whitney <enwlinux@gmail.com>2017-04-02 12:57:05 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-04-13 11:47:12 -0400
commit971269316b8064ce648e0f9b95ab2163ab04568c (patch)
tree13fc070466ea481736ea0b11ed4a7d4a576ac1a1 /e2fsck/pass3.c
parent2541e012804042d7210311c7a923c414c8aa31e3 (diff)
downloade2fsprogs-971269316b8064ce648e0f9b95ab2163ab04568c.tar.gz
e2fsck: fix quota accounting to use cluster units
The quota accounting code in e2fsck's pass 1 and pass 3 uses block units rather than cluster units when recording the allocated space consumed by files and directories. In pass 1, this causes a large undercount of actual quota results and test failures for xfstests generic/383, /384, /385, and /386 on bigalloc file systems. In pass 3, this results in quota accounting errors when the lost+found directory is either extended or recreated on a bigalloc file system. Use clusters rather than blocks when accounting for allocated space, and correct a related header comment in the quota code. Note that pass 1b also contains call sites for quota_data_sub() that also need to be addressed. However, it appears that more than just unit conversion may be needed, so that will be left to a future patch. Signed-off-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass3.c')
-rw-r--r--e2fsck/pass3.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 44203ca0..4d9430bb 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -578,7 +578,7 @@ link_error:
ext2fs_icount_store(ctx->inode_count, ino, 2);
ext2fs_icount_store(ctx->inode_link_info, ino, 2);
ctx->lost_and_found = ino;
- quota_data_add(ctx->qctx, &inode, ino, fs->blocksize);
+ quota_data_add(ctx->qctx, &inode, ino, EXT2_CLUSTER_SIZE(fs->super));
quota_data_inodes(ctx->qctx, &inode, ino, +1);
#if 0
printf("/lost+found created; inode #%lu\n", ino);
@@ -899,7 +899,8 @@ errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir,
if (retval)
return retval;
ext2fs_iblk_add_blocks(fs, EXT2_INODE(&inode), es.newblocks);
- quota_data_add(ctx->qctx, &inode, dir, es.newblocks * fs->blocksize);
+ quota_data_add(ctx->qctx, &inode, dir,
+ es.newblocks * EXT2_CLUSTER_SIZE(fs->super));
e2fsck_write_inode_full(ctx, dir, EXT2_INODE(&inode),
sizeof(inode), "expand_directory");