* [f2fs-dev] [PATCH v2] f2fs-tools: remove unnecessary alignment for blocks_for_ssa
@ 2025-09-29 20:21 Daeho Jeong
0 siblings, 0 replies; only message in thread
From: Daeho Jeong @ 2025-09-29 20:21 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-29 20:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 20:21 [f2fs-dev] [PATCH v2] f2fs-tools: remove unnecessary alignment for blocks_for_ssa Daeho Jeong
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).