From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: [f2fs-dev] [PATCH v2] f2fs-tools: remove unnecessary alignment for blocks_for_ssa
Date: Mon, 29 Sep 2025 13:21:52 -0700 [thread overview]
Message-ID: <20250929202152.2984080-1-daeho43@gmail.com> (raw)
From: Daeho Jeong <daehojeong@google.com>
total_valid_blks_available is already a multiple of c.blks_per_seg.
So, we don't need an additional alignment adjustment.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
---
v2: add ASSERT() to ensure total_valid_blks_available is a multiple of
c.blks_per_seg
---
mkfs/f2fs_format.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index b98976c..6deb671 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -497,11 +497,12 @@ static int f2fs_prepare_super_block(void)
get_sb(segment_count_nat))) *
c.blks_per_seg;
- if (c.feature & F2FS_FEATURE_RO)
+ if (c.feature & F2FS_FEATURE_RO) {
blocks_for_ssa = 0;
- else
- blocks_for_ssa = total_valid_blks_available /
- c.blks_per_seg + 1;
+ } else {
+ ASSERT((total_valid_blks_available % c.blks_per_seg) == 0);
+ blocks_for_ssa = total_valid_blks_available / c.blks_per_seg;
+ }
set_sb(segment_count_ssa, SEG_ALIGN(blocks_for_ssa));
--
2.51.0.570.gb178f27e6d-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
reply other threads:[~2025-09-29 20:22 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=20250929202152.2984080-1-daeho43@gmail.com \
--to=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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).