linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
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 16:18:23 -0700	[thread overview]
Message-ID: <Y1HXP7ysrNXX+oR8@google.com> (raw)
In-Reply-To: <20221020090708.tiysx3qsgatb3ngv@shindev>

On 10/20, Shinichiro Kawasaki wrote:
> 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?

Thanks, I think that fix looks good to me. I applied into the original patch.
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?h=dev&id=281d3e72370f6c39c0d57acaf37a7f0e003ddd28

> 
> 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.

I think you can try to avoid that by tuning /sys/fs/f2fs/xx/reserved_blocks?

> 
> [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

  reply	other threads:[~2022-10-20 23:18 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 ` [f2fs-dev] [PATCH 1/3] f2fs-tools: give less overprovisioning space Shinichiro Kawasaki via Linux-f2fs-devel
2022-10-20 23:18   ` Jaegeuk Kim [this message]
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=Y1HXP7ysrNXX+oR8@google.com \
    --to=jaegeuk@kernel.org \
    --cc=Damien.LeMoal@wdc.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --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).