diff options
author | Aditya Kali <adityakali@google.com> | 2011-07-20 11:40:06 -0700 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-08-31 16:31:13 -0400 |
commit | 624e4a6466dba9889f5f80dc168f2bb7c2a3f5d0 (patch) | |
tree | d4d5748fc2baea48a1cb6a9ad0e66300cdcc3b3f /e2fsck/pass2.c | |
parent | f239fefc14226f655477179801c734749a04d4b4 (diff) | |
download | android_external_e2fsprogs-624e4a6466dba9889f5f80dc168f2bb7c2a3f5d0.tar.gz android_external_e2fsprogs-624e4a6466dba9889f5f80dc168f2bb7c2a3f5d0.tar.bz2 android_external_e2fsprogs-624e4a6466dba9889f5f80dc168f2bb7c2a3f5d0.zip |
e2fsck: add support for checking the built-in quota files
This patch adds support for doing quota accounting during full
e2fsck scan if the 'quota' feature was set on the superblock.
If user-visible quota inodes are in use, they will be hidden
and converted to the reserved quota inodes.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass2.c')
-rw-r--r-- | e2fsck/pass2.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 28636992..e57afb9b 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1149,6 +1149,11 @@ abort_free_dict: return DIRENT_ABORT; } +struct del_block { + e2fsck_t ctx; + e2_blkcnt_t num; +}; + /* * This function is called to deallocate a block, and is an interator * functioned called by deallocate inode via ext2fs_iterate_block(). @@ -1160,15 +1165,16 @@ static int deallocate_inode_block(ext2_filsys fs, int ref_offset EXT2FS_ATTR((unused)), void *priv_data) { - e2fsck_t ctx = (e2fsck_t) priv_data; + struct del_block *p = priv_data; if (HOLE_BLKADDR(*block_nr)) return 0; if ((*block_nr < fs->super->s_first_data_block) || (*block_nr >= ext2fs_blocks_count(fs->super))) return 0; - ext2fs_unmark_block_bitmap2(ctx->block_found_map, *block_nr); + ext2fs_unmark_block_bitmap2(p->ctx->block_found_map, *block_nr); ext2fs_block_alloc_stats2(fs, *block_nr, -1); + p->num++; return 0; } @@ -1181,6 +1187,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf) struct ext2_inode inode; struct problem_context pctx; __u32 count; + struct del_block del_block; e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode"); e2fsck_clear_inode(ctx, ino, &inode, 0, "deallocate_inode"); @@ -1223,8 +1230,11 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf) if (LINUX_S_ISREG(inode.i_mode) && EXT2_I_SIZE(&inode) >= 0x80000000UL) ctx->large_files--; + del_block.ctx = ctx; + del_block.num = 0; pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf, - deallocate_inode_block, ctx); + deallocate_inode_block, + &del_block); if (pctx.errcode) { fix_problem(ctx, PR_2_DEALLOC_INODE, &pctx); ctx->flags |= E2F_FLAG_ABORT; |