From: Yonggil Song <yonggil.song@samsung.com>
To: Yonggil Song <yonggil.song@samsung.com>,
Chao Yu <chao@kernel.org>,
"jaegeuk@kernel.org" <jaegeuk@kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dongjin Kim <dongjin_.kim@samsung.com>,
Siwoo Jung <siu.jung@samsung.com>,
Daejun Park <daejun7.park@samsung.com>
Subject: [PATCH v2] libf2fs: Fix calculation of usable segments for single
Date: Thu, 10 Oct 2024 13:59:35 +0900 [thread overview]
Message-ID: <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7> (raw)
In-Reply-To: <20241010043123epcms2p2ad514eb5e4a94413d8b26aea56f772a8@epcms2p2>
There was a problem that did not subtract the super block area when calculating
the usable segments for a single zoned device with a conventional zone.
This resulted in incorrect the overprovision and reserved area.
<256MiB legacy block + zoned block w/ 32MiB zone size>
Info: Overprovision ratio = 3.570%
Info: Overprovision segments = 656 (GC reserved = 560)
<8 conventional zone + 1016 sequential zone w/ 32MiB zone size>
Info: Overprovision ratio = 3.700%
Info: Overprovision segments = 676 (GC reserved = 578)
This patch addresses the problem by subtracting the super block area when
there is only one zoned device.
Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
---
lib/libf2fs_zoned.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index 89ba5ad73a76..1a0985378789 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -555,6 +555,11 @@ uint32_t f2fs_get_usable_segments(struct f2fs_super_block *sb)
}
usable_segs -= (get_sb(main_blkaddr) - get_sb(segment0_blkaddr)) >>
get_sb(log_blocks_per_seg);
+
+ /* single zoned device needs to remove a super block area */
+ if (c.ndevs == 1 && c.devices[0].zoned_model == F2FS_ZONED_HM)
+ usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg));
+
return usable_segs;
#endif
return get_sb(segment_count_main);
--
2.43.0
next prev parent reply other threads:[~2024-10-10 4:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p8>
2024-10-07 5:21 ` [PATCH] libf2fs: Fix calculation of usable segments for single zoned Yonggil Song
2024-10-08 9:02 ` Chao Yu
2024-10-08 13:16 ` Markus Elfring
[not found] ` <CGME20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p2>
2024-10-10 2:15 ` Yonggil Song
2024-10-10 4:31 ` Yonggil Song
[not found] ` <CGME20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p7>
2024-10-10 4:59 ` Yonggil Song [this message]
2024-10-11 15:34 ` [PATCH v2] libf2fs: Fix calculation of usable segments for single Jaegeuk Kim
[not found] ` <CGME20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p3>
2024-10-14 1:43 ` Yonggil Song
2024-10-10 5:08 ` [RESEND][PATCH v2] libf2fs: Fix calculation of usable segments for single zoned device Yonggil Song
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=20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7 \
--to=yonggil.song@samsung.com \
--cc=chao@kernel.org \
--cc=daejun7.park@samsung.com \
--cc=dongjin_.kim@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=siu.jung@samsung.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
all inboxes | Powered by JetHome®