linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 3/4] fsck.f2fs: add more debug info in fsck_verify()
Date: Fri, 12 May 2023 18:03:53 +0800	[thread overview]
Message-ID: <20230512100354.4072489-3-chao@kernel.org> (raw)
In-Reply-To: <20230512100354.4072489-1-chao@kernel.org>

In order to track details of stat info and repair flow.

[FSCK] valid_block_count matching with CP             [Fail] [0x2, 0x0]
[FSCK] valid_node_count matching with CP (de lookup)  [Fail] [0x1, 0x0]
[FSCK] valid_node_count matching with CP (nat lookup) [Fail] [0x1, 0x0]
[FSCK] valid_inode_count matched with CP              [Fail] [0x1, 0x0]

Info: flush_journal_entries() n_nats: 1, n_sits: 6
Info: write_checkpoint() cur_cp:1
Info: fix_checkpoint() cur_cp:1

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/fsck.c  | 18 +++++++++++++-----
 fsck/mount.c |  7 ++++++-
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 9180deb..3650873 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2407,6 +2407,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
 
 	ret = f2fs_fsync_device();
 	ASSERT(ret >= 0);
+
+	MSG(0, "Info: fix_checkpoint() cur_cp:%d\n", sbi->cur_cp);
 }
 
 static void fix_checkpoints(struct f2fs_sb_info *sbi)
@@ -3284,7 +3286,8 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 	if (sbi->total_valid_block_count == fsck->chk.valid_blk_cnt) {
 		printf(" [Ok..] [0x%x]\n", (u32)fsck->chk.valid_blk_cnt);
 	} else {
-		printf(" [Fail] [0x%x]\n", (u32)fsck->chk.valid_blk_cnt);
+		printf(" [Fail] [0x%x, 0x%x]\n", sbi->total_valid_block_count,
+					(u32)fsck->chk.valid_blk_cnt);
 		verify_failed = true;
 	}
 
@@ -3292,7 +3295,8 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 	if (sbi->total_valid_node_count == fsck->chk.valid_node_cnt) {
 		printf(" [Ok..] [0x%x]\n", fsck->chk.valid_node_cnt);
 	} else {
-		printf(" [Fail] [0x%x]\n", fsck->chk.valid_node_cnt);
+		printf(" [Fail] [0x%x, 0x%x]\n", sbi->total_valid_node_count,
+						fsck->chk.valid_node_cnt);
 		verify_failed = true;
 	}
 
@@ -3300,7 +3304,8 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 	if (sbi->total_valid_node_count == fsck->chk.valid_nat_entry_cnt) {
 		printf(" [Ok..] [0x%x]\n", fsck->chk.valid_nat_entry_cnt);
 	} else {
-		printf(" [Fail] [0x%x]\n", fsck->chk.valid_nat_entry_cnt);
+		printf(" [Fail] [0x%x, 0x%x]\n", sbi->total_valid_node_count,
+						fsck->chk.valid_nat_entry_cnt);
 		verify_failed = true;
 	}
 
@@ -3308,7 +3313,8 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 	if (sbi->total_valid_inode_count == fsck->chk.valid_inode_cnt) {
 		printf(" [Ok..] [0x%x]\n", fsck->chk.valid_inode_cnt);
 	} else {
-		printf(" [Fail] [0x%x]\n", fsck->chk.valid_inode_cnt);
+		printf(" [Fail] [0x%x, 0x%x]\n", sbi->total_valid_inode_count,
+						fsck->chk.valid_inode_cnt);
 		verify_failed = true;
 	}
 
@@ -3317,7 +3323,9 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 						fsck->chk.sit_free_segs) {
 		printf(" [Ok..] [0x%x]\n", fsck->chk.sit_free_segs);
 	} else {
-		printf(" [Fail] [0x%x]\n", fsck->chk.sit_free_segs);
+		printf(" [Fail] [0x%x, 0x%x]\n",
+			le32_to_cpu(F2FS_CKPT(sbi)->free_segment_count),
+			fsck->chk.sit_free_segs);
 		verify_failed = true;
 	}
 
diff --git a/fsck/mount.c b/fsck/mount.c
index f0b0072..f19f081 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2782,8 +2782,11 @@ void flush_journal_entries(struct f2fs_sb_info *sbi)
 	int n_nats = flush_nat_journal_entries(sbi);
 	int n_sits = flush_sit_journal_entries(sbi);
 
-	if (n_nats || n_sits)
+	if (n_nats || n_sits) {
+		MSG(0, "Info: flush_journal_entries() n_nats: %d, n_sits: %d\n",
+							n_nats, n_sits);
 		write_checkpoints(sbi);
+	}
 }
 
 void flush_sit_entries(struct f2fs_sb_info *sbi)
@@ -3259,6 +3262,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
 
 	ret = f2fs_fsync_device();
 	ASSERT(ret >= 0);
+
+	MSG(0, "Info: write_checkpoint() cur_cp:%d\n", sbi->cur_cp);
 }
 
 void write_checkpoints(struct f2fs_sb_info *sbi)
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2023-05-12 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 10:03 [f2fs-dev] [PATCH 1/4] fsck.f2fs: wrap openned codes into fsck_sanity_check_nid() Chao Yu
2023-05-12 10:03 ` [f2fs-dev] [PATCH 2/4] fsck.f2fs: use f2fs_is_valid_blkaddr() Chao Yu
2023-05-12 10:03 ` Chao Yu [this message]
2023-05-12 10:03 ` [f2fs-dev] [PATCH 4/4] fsck.f2fs: lookup and relink root inode Chao Yu

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=20230512100354.4072489-3-chao@kernel.org \
    --to=chao@kernel.org \
    --cc=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).