linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yonggil Song <yonggil.song@samsung.com>
Cc: Chao Yu <chao@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: Re: [PATCH v2] libf2fs: Fix calculation of usable segments for single
Date: Fri, 11 Oct 2024 15:34:40 +0000	[thread overview]
Message-ID: <ZwlFkBAV2yxf1DBt@google.com> (raw)
In-Reply-To: <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7>

On 10/10, Yonggil Song wrote:
> 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)

Does this work?

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

  parent reply	other threads:[~2024-10-11 15:34 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-10  2:15     ` Yonggil Song
2024-10-10  4:31       ` Yonggil Song
2024-10-10  4:59         ` [PATCH v2] libf2fs: Fix calculation of usable segments for single Yonggil Song
2024-10-10  5:08           ` [RESEND][PATCH v2] libf2fs: Fix calculation of usable segments for single zoned device Yonggil Song
2024-10-11 15:34           ` Jaegeuk Kim [this message]
2024-10-14  1:43             ` RE:(2) [PATCH v2] libf2fs: Fix calculation of usable segments for single Yonggil Song
2024-10-08 13:16   ` [PATCH] libf2fs: Fix calculation of usable segments for single zoned Markus Elfring

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=ZwlFkBAV2yxf1DBt@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=daejun7.park@samsung.com \
    --cc=dongjin_.kim@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=siu.jung@samsung.com \
    --cc=yonggil.song@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;
as well as URLs for NNTP newsgroup(s).