From: Shinichiro Kawasaki via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH 1/3] f2fs-tools: give less overprovisioning space
Date: Thu, 20 Oct 2022 09:07:10 +0000 [thread overview]
Message-ID: <20221020090708.tiysx3qsgatb3ngv@shindev> (raw)
In-Reply-To: <20221010221548.2728860-1-jaegeuk@kernel.org>
On Oct 10, 2022 / 15:15, Jaegeuk Kim wrote:
> As f2fs becomes more resilient for GCs, let's give the marginal overprovision
> space back to user.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Hello Jaegeuk,
Using the dev branch of f2fs-tools repo, I observed mkfs.f2fs failure with zoned
block devices:
Error: Device size is not sufficient for F2FS volume
I found this patch in the branch triggers it. I also observed the same failure
is observed with non- zoned regular block devices when I specify -s options to
mkfs.f2fs command. With these conditions, number of segments in each section is
not zero, and it increases the number of reserved segments. My understanding is
that it makes reserved segments larger than overprovisioning segments all the
time in the loop of get_best_overprovision(). Then get_best_overprovision()
returns 0% overprovisioning ratio. Hence the error.
Could you take a look for fix?
FYI, I tried to fix and created a patch which allows reserved segments larger
than overprovisioning segments [1]. It compares those two, and take larger one
to subtract from usable segments to get the segments for users. I confirmed it
keeps small number of overprovisioning segments for no -s option case, and
avoids the mkfs.f2fs failure for the -s option and zoned block device cases.
However, it increases runtime of my test script which fills f2fs and do file
overwrites to test f2fs GC on zoned block devices. It takes +60% longer runtime.
Then GC performance looks worse than before, and this fix does not look good
for me.
[1]
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 8ca574a..4902953 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -1634,9 +1634,10 @@ static inline double get_best_overprovision(struct f2fs_super_block *sb)
reserved = (100 / candidate + 1 + NR_CURSEG_TYPE) *
round_up(usable_main_segs, get_sb(section_count));
ovp = (usable_main_segs - reserved) * candidate / 100;
- if (reserved >= ovp)
+ if (ovp < 0)
continue;
- space = usable_main_segs - ovp;
+
+ space = usable_main_segs - max(reserved, ovp);
if (max_space < space) {
max_space = space;
max_ovp = candidate;
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index c314d1c..08f4e66 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -764,11 +764,8 @@ static int f2fs_write_check_point_pack(void)
set_cp(overprov_segment_count, (f2fs_get_usable_segments(sb) -
get_cp(rsvd_segment_count)) *
c.overprovision / 100);
-
- if (get_cp(rsvd_segment_count) > get_cp(overprov_segment_count)) {
- MSG(0, "\tError: Wrong overprovision ratio\n");
- goto free_cp_payload;
- }
+ if (get_cp(overprov_segment_count) < get_cp(rsvd_segment_count))
+ set_cp(overprov_segment_count, get_cp(rsvd_segment_count));
if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
MSG(0, "\tError: Not enough segments to create F2FS Volume\n");
--
Shin'ichiro Kawasaki
_______________________________________________
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:[~2022-10-20 9:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 22:15 [f2fs-dev] [PATCH 1/3] f2fs-tools: give less overprovisioning space Jaegeuk Kim
2022-10-10 22:15 ` [f2fs-dev] [PATCH 2/3] fsck.f2fs: fix missing to assign c.zoned_model Jaegeuk Kim
2022-10-10 22:15 ` [f2fs-dev] [PATCH 3/3] f2fs-tools: set host-aware zoned device similar to host-managed one Jaegeuk Kim
2022-10-20 9:07 ` Shinichiro Kawasaki via Linux-f2fs-devel [this message]
2022-10-20 23:18 ` [f2fs-dev] [PATCH 1/3] f2fs-tools: give less overprovisioning space Jaegeuk Kim
2022-10-21 4:30 ` Shinichiro Kawasaki via Linux-f2fs-devel
2022-10-24 17:55 ` Jaegeuk Kim
2022-10-26 20:37 ` [f2fs-dev] [PATCH 1/3 v2] " 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=20221020090708.tiysx3qsgatb3ngv@shindev \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=Damien.LeMoal@wdc.com \
--cc=jaegeuk@kernel.org \
--cc=shinichiro.kawasaki@wdc.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;
as well as URLs for NNTP newsgroup(s).