Linux-f2fs-devel Archive mirror
 help / color / mirror / Atom feed
From: Sheng Yong via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org, chao@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] resize.f2fs: get value from new sb during rebuilding cp
Date: Mon,  8 Apr 2024 21:11:57 +0800	[thread overview]
Message-ID: <20240408131157.4100204-1-shengyong@oppo.com> (raw)

Althrough old and new sb have the same value for now, it would be better
to build new checkpoint according to new sb.

Signed-off-by: Sheng Yong <shengyong@oppo.com>
---
 fsck/resize.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fsck/resize.c b/fsck/resize.c
index 049ddd3..1b4ae85 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -481,7 +481,7 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
 		set_cp(overprov_segment_count, get_cp(rsvd_segment_count));
 
 	set_cp(overprov_segment_count, get_cp(overprov_segment_count) +
-						2 * get_sb(segs_per_sec));
+						2 * get_newsb(segs_per_sec));
 
 	DBG(0, "Info: Overprovision ratio = %.3lf%%\n", c.new_overprovision);
 	DBG(0, "Info: Overprovision segments = %u (GC reserved = %u)\n",
@@ -551,11 +551,12 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
 							cpu_to_le32(crc);
 
 	/* Write a new checkpoint in the other set */
-	new_cp_blk_no = old_cp_blk_no = get_sb(cp_blkaddr);
+	old_cp_blk_no = get_sb(cp_blkaddr);
+	new_cp_blk_no = get_newsb(cp_blkaddr);
 	if (sbi->cur_cp == 2)
 		old_cp_blk_no += 1 << get_sb(log_blocks_per_seg);
 	else
-		new_cp_blk_no += 1 << get_sb(log_blocks_per_seg);
+		new_cp_blk_no += 1 << get_newsb(log_blocks_per_seg);
 
 	/* write first cp */
 	ret = dev_write_block(new_cp, new_cp_blk_no++);
-- 
2.40.1



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

             reply	other threads:[~2024-04-08 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 13:11 Sheng Yong via Linux-f2fs-devel [this message]
2024-04-08 18:34 ` [f2fs-dev] [PATCH] resize.f2fs: get value from new sb during rebuilding cp Jaegeuk Kim
2024-04-09  1:54   ` Sheng Yong via Linux-f2fs-devel
2024-04-10  0:38     ` Jaegeuk Kim
2024-04-10  2:11       ` Sheng Yong via Linux-f2fs-devel

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=20240408131157.4100204-1-shengyong@oppo.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=shengyong@oppo.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).