Checking nat entries with nat_area_bitmap should be done before quota check, since fsck_chk_quota_node() unsets quota inode numbers in nat_area_bitmap. It causes for -p1 to conduct full scan.
Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> --- fsck/fsck.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 91c8529..688f24b 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1788,19 +1788,7 @@ int fsck_chk_meta(struct f2fs_sb_info *sbi) if (fsck_chk_orphan_node(sbi)) return -EINVAL; - /* 5. check quota inode simply */ - if (fsck_chk_quota_node(sbi)) - return -EINVAL; - - if (fsck->nat_valid_inode_cnt != le32_to_cpu(cp->valid_inode_count)) { - ASSERT_MSG("valid inode does not match: nat_valid_inode_cnt %u," - " valid_inode_count %u", - fsck->nat_valid_inode_cnt, - le32_to_cpu(cp->valid_inode_count)); - return -EINVAL; - } - - /*check nat entry with sit_area_bitmap*/ + /* 5. check nat entry -- must be done before quota check */ for (i = 0; i < fsck->nr_nat_entries; i++) { u32 blk = le32_to_cpu(fsck->entries[i].block_addr); nid_t ino = le32_to_cpu(fsck->entries[i].ino); @@ -1840,6 +1828,18 @@ int fsck_chk_meta(struct f2fs_sb_info *sbi) } } + /* 6. check quota inode simply */ + if (fsck_chk_quota_node(sbi)) + return -EINVAL; + + if (fsck->nat_valid_inode_cnt != le32_to_cpu(cp->valid_inode_count)) { + ASSERT_MSG("valid inode does not match: nat_valid_inode_cnt %u," + " valid_inode_count %u", + fsck->nat_valid_inode_cnt, + le32_to_cpu(cp->valid_inode_count)); + return -EINVAL; + } + return 0; } -- 2.17.0.484.g0c8726318c-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel