From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH 2/3] mkfs.f2fs: adjust zone alignment when using multi-partitions
Date: Fri, 18 Dec 2020 08:17:07 -0800 [thread overview]
Message-ID: <20201218161708.927900-2-jaegeuk@kernel.org> (raw)
In-Reply-To: <20201218161708.927900-1-jaegeuk@kernel.org>
When formatting conventional partition with zoned one, we should align
the starting block address of next device to the zone size.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
mkfs/f2fs_format.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a6c542e8e1f0..f60dcc029d58 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -254,14 +254,22 @@ static int f2fs_prepare_super_block(void)
return -1;
}
+ if (c.zoned_mode && c.ndevs > 1)
+ zone_align_start_offset +=
+ (c.devices[0].total_sectors * c.sector_size) % zone_size_bytes;
+
set_sb(segment0_blkaddr, zone_align_start_offset / blk_size_bytes);
sb->cp_blkaddr = sb->segment0_blkaddr;
MSG(0, "Info: zone aligned segment0 blkaddr: %u\n",
get_sb(segment0_blkaddr));
- if (c.zoned_mode && (get_sb(segment0_blkaddr) + c.start_sector /
- DEFAULT_SECTORS_PER_BLOCK) % c.zone_blocks) {
+ 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;
--
2.29.2.729.g45daf8777d-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2020-12-18 16:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 16:17 [f2fs-dev] [PATCH 1/3] fsck.f2fs: fix alignment on multi-partition support Jaegeuk Kim
2020-12-18 16:17 ` Jaegeuk Kim [this message]
2020-12-18 16:17 ` [f2fs-dev] [PATCH 3/3] mkfs.f2fs: allocate zones together to avoid random access Jaegeuk Kim
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=20201218161708.927900-2-jaegeuk@kernel.org \
--to=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).