From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH] fsck.f2fs: fix check order in -p1
Date: Mon, 7 May 2018 11:53:13 -0700 [thread overview]
Message-ID: <20180507185313.75217-1-jaegeuk@kernel.org> (raw)
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
reply other threads:[~2018-05-07 18:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180507185313.75217-1-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).