From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB4E1D0D7BB for ; Fri, 11 Oct 2024 15:34:56 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1szHfM-0006ij-4A; Fri, 11 Oct 2024 15:34:55 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1szHfF-0006ia-9r for linux-f2fs-devel@lists.sourceforge.net; Fri, 11 Oct 2024 15:34:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gRIzntNMWr8NwfLtmzW4wZctrY8nWyuF2Nh0asy2ZEw=; b=cwvFR+YObVhxqf/Oq71l5e/Cyq IfRS5qWssct/rdEKWBCbp7WcTd5YlQwzrRJTAVhX5Vr7f00aCyhklIOzp4vnqnM9EfQ3n1jN+4fxC AcqukdQgMhK0PoXB9y5ykQgeskdn2cayfz6e5P9xwTS+gg8NdkccyFws/nJRnQ8Mr4LY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gRIzntNMWr8NwfLtmzW4wZctrY8nWyuF2Nh0asy2ZEw=; b=ZhIETK36Cxe/V9QAGCuC0zFThO JxBnfy4NwmhmGi+kZG9ZH1uW4tyuAHQVAWFjCq0/zSaxIpv/0hqSoo7Jt/v9YJo6sRs3mzOEwqBLY ld06/rQDnWocgFfACcarCVAa4gfHLNzMNfZR9lRoaLX0tfTj1SvL0gRNIgLypmZJzioQ=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1szHfE-00078l-1F for linux-f2fs-devel@lists.sourceforge.net; Fri, 11 Oct 2024 15:34:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 58E175C03E3; Fri, 11 Oct 2024 15:34:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 023EEC4CEC3; Fri, 11 Oct 2024 15:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728660882; bh=2zjq4Ks3ur9+Akzi/sv+mw+4+XesiyAmSjBvkeudVnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XrYYv8WpBXqLu3Zd+a3ilj9tVg/ivwC/p4/3/Bi3LvKsXPbnB9MkYuL6Bf+fhkJnz IAgr54fHcMIl89Bhj4qpdnI3pMRKwsf/ZPuVp7Zp0w9S9tLb/HYvt+LZlXuVnuBCJz 2QFrSwUnMGfA4p5ZWZjn6ueJQZpmYZw23wCBppXrrH3lqnJRzIXNkFq5daA5KrngJ7 a8zlyHlxF+eb2SZ6D/2CxFnnUTKZ4pAZ8RRHz8BrZo4zWAlHXCgNibOSM+bZXQRAXM PZdkpPus0Y7WR4V7SZL5qmDFqQnI7UEmNpav+XGOS1FTxNbjzSQrcjje97sF17f+GS fylUdXK/Wx1RA== Date: Fri, 11 Oct 2024 15:34:40 +0000 To: Yonggil Song Message-ID: References: <20241010043123epcms2p2ad514eb5e4a94413d8b26aea56f772a8@epcms2p2> <20241010021506epcms2p21d877e3c72389b41805db31f391d2b42@epcms2p2> <20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p8> <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7> X-Headers-End: 1szHfE-00078l-1F Subject: Re: [f2fs-dev] [PATCH v2] libf2fs: Fix calculation of usable segments for single X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jaegeuk Kim via Linux-f2fs-devel Reply-To: Jaegeuk Kim Cc: "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , Siwoo Jung , Dongjin Kim Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 > --- > 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B44235381E for ; Fri, 11 Oct 2024 15:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660882; cv=none; b=BlF2Gwpw9WTXOrraEVAI2isCX50nBDE1yRngcQ/z0gQheqM8RdJm6IDrcYRi7//Ys7LKnyeQJKXXJiKmfgkLncBHAyqaPu4vCkSv3RwIIV6S7u1AG4GuDZdLcvzzccTvaEkEseAst6sLpDV5dzrtyJuEUfqwRwsfAn/6QOyjW1M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660882; c=relaxed/simple; bh=2zjq4Ks3ur9+Akzi/sv+mw+4+XesiyAmSjBvkeudVnc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WL1L5+vIpmSd7Cej/iICT7uUcFnwaBHU2lhHHGycLIgDGYFfHi7Wqp2EnREBBW8nkhoQLyM8hOK3kcI8t7slpgIqoqiz9psgMw/BU94vPE1cjkGhnlvijU8Veest8/zQ86z0h1n8wHc0desVzZOWKkbZX627HgI3UU+/enbQdPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XrYYv8Wp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XrYYv8Wp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 023EEC4CEC3; Fri, 11 Oct 2024 15:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728660882; bh=2zjq4Ks3ur9+Akzi/sv+mw+4+XesiyAmSjBvkeudVnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XrYYv8WpBXqLu3Zd+a3ilj9tVg/ivwC/p4/3/Bi3LvKsXPbnB9MkYuL6Bf+fhkJnz IAgr54fHcMIl89Bhj4qpdnI3pMRKwsf/ZPuVp7Zp0w9S9tLb/HYvt+LZlXuVnuBCJz 2QFrSwUnMGfA4p5ZWZjn6ueJQZpmYZw23wCBppXrrH3lqnJRzIXNkFq5daA5KrngJ7 a8zlyHlxF+eb2SZ6D/2CxFnnUTKZ4pAZ8RRHz8BrZo4zWAlHXCgNibOSM+bZXQRAXM PZdkpPus0Y7WR4V7SZL5qmDFqQnI7UEmNpav+XGOS1FTxNbjzSQrcjje97sF17f+GS fylUdXK/Wx1RA== Date: Fri, 11 Oct 2024 15:34:40 +0000 From: Jaegeuk Kim To: Yonggil Song Cc: Chao Yu , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , Dongjin Kim , Siwoo Jung , Daejun Park Subject: Re: [PATCH v2] libf2fs: Fix calculation of usable segments for single Message-ID: References: <20241010043123epcms2p2ad514eb5e4a94413d8b26aea56f772a8@epcms2p2> <20241010021506epcms2p21d877e3c72389b41805db31f391d2b42@epcms2p2> <20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p8> <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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