From: Zhiguo Niu <zhiguo.niu@unisoc.com>
To: <jaegeuk@kernel.org>, <chao@kernel.org>
Cc: ke.wang@unisoc.com, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, zhiguo.niu@unisoc.com,
Hao_hao.Wang@unisoc.com
Subject: [f2fs-dev] [PATCH] mkfs.f2fs: adjust zone alignment check to correct position
Date: Tue, 5 Nov 2024 19:25:05 +0800 [thread overview]
Message-ID: <1730805905-31895-1-git-send-email-zhiguo.niu@unisoc.com> (raw)
Should check after c.devices[1].start_blkaddr is assigned
if c.ndevs > 1.
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
mkfs/f2fs_format.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 52a1e18..f7cfa5e 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -339,17 +339,6 @@ static int f2fs_prepare_super_block(void)
MSG(0, "Info: zone aligned segment0 blkaddr: %u\n",
get_sb(segment0_blkaddr));
- if (c.zoned_mode &&
- ((c.ndevs == 1 &&
- (get_sb(segment0_blkaddr) + c.start_sector /
- DEFAULT_SECTORS_PER_BLOCK) % c.zone_blocks) ||
- (c.ndevs > 1 &&
- c.devices[1].start_blkaddr % c.zone_blocks))) {
- MSG(1, "\tError: Unaligned segment0 block address %u\n",
- get_sb(segment0_blkaddr));
- return -1;
- }
-
for (i = 0; i < c.ndevs; i++) {
if (i == 0) {
c.devices[i].total_segments =
@@ -390,6 +379,18 @@ static int f2fs_prepare_super_block(void)
c.total_segments += c.devices[i].total_segments;
}
+
+ if (c.zoned_mode &&
+ ((c.ndevs == 1 &&
+ (get_sb(segment0_blkaddr) + c.start_sector /
+ DEFAULT_SECTORS_PER_BLOCK) % c.zone_blocks) ||
+ (c.ndevs > 1 &&
+ c.devices[1].start_blkaddr % c.zone_blocks))) {
+ MSG(1, "\tError: Unaligned segment0 block address %u\n",
+ get_sb(segment0_blkaddr));
+ return -1;
+ }
+
set_sb(segment_count, c.total_segments);
set_sb(segment_count_ckpt, F2FS_NUMBER_OF_CHECKPOINT_PACK);
--
1.9.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2024-11-05 11:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 11:25 Zhiguo Niu [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-07-14 9:51 [f2fs-dev] [PATCH] mkfs.f2fs: adjust zone alignment check to correct position Zhiguo Niu via Linux-f2fs-devel
2025-07-15 6:52 ` Chao Yu 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=1730805905-31895-1-git-send-email-zhiguo.niu@unisoc.com \
--to=zhiguo.niu@unisoc.com \
--cc=Hao_hao.Wang@unisoc.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=ke.wang@unisoc.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).