linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: fix check order in -p1
@ 2018-05-07 18:53 Jaegeuk Kim
  0 siblings, 0 replies; only message in thread
From: Jaegeuk Kim @ 2018-05-07 18:53 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

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 <jaegeuk@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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-07 18:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-07 18:53 [PATCH] fsck.f2fs: fix check order in -p1 Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).