diff options
author | Hyojun Kim <hyojun@google.com> | 2017-10-30 23:21:09 +0000 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-11-06 20:07:40 -0800 |
commit | 6c6bb35c8920f1094c355d6352ce7d9c333b5e48 (patch) | |
tree | 67be5b30f44a7510da314d4f38fadf43ba1c2fac /fsck/main.c | |
parent | 23a872f9bace9cc97a31293cdbc59522784004c0 (diff) | |
download | f2fs-tools-6c6bb35c8920f1094c355d6352ce7d9c333b5e48.tar.gz |
fsck.f2fs: support quota
This patch let fsck to check and fix quota file contents.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Diffstat (limited to 'fsck/main.c')
-rw-r--r-- | fsck/main.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fsck/main.c b/fsck/main.c index c9411eb..eab213d 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -18,6 +18,7 @@ #include "fsck.h" #include <libgen.h> #include <ctype.h> +#include "quotaio.h" struct f2fs_fsck gfsck; @@ -407,6 +408,7 @@ static void do_fsck(struct f2fs_sb_info *sbi) struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); u32 flag = le32_to_cpu(ckpt->ckpt_flags); u32 blk_cnt; + errcode_t ret; fsck_init(sbi); @@ -429,8 +431,7 @@ static void do_fsck(struct f2fs_sb_info *sbi) c.fix_on = 1; break; } - } else { - /* + } else { /* * we can hit this in 3 situations: * 1. fsck -f, fix_on has already been set to 1 when * parsing options; @@ -443,12 +444,23 @@ static void do_fsck(struct f2fs_sb_info *sbi) c.fix_on = 1; } - fsck_chk_orphan_node(sbi); + fsck_chk_quota_node(sbi); /* Traverse all block recursively from root inode */ blk_cnt = 1; + + if (c.feature & cpu_to_le32(F2FS_FEATURE_QUOTA_INO)) { + ret = quota_init_context(sbi); + if (ret) { + ASSERT_MSG("quota_init_context failure: %d", ret); + return; + } + } + fsck_chk_orphan_node(sbi); fsck_chk_node_blk(sbi, NULL, sbi->root_ino_num, F2FS_FT_DIR, TYPE_INODE, &blk_cnt, NULL); + fsck_chk_quota_files(sbi); + fsck_verify(sbi); fsck_free(sbi); } |