From patchwork Thu Oct 10 04:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggil Song X-Patchwork-Id: 13829470 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 C341BCF07A2 for ; Thu, 10 Oct 2024 04:59:54 +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 1sylHF-0005QJ-N0; Thu, 10 Oct 2024 04:59:53 +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 1sylHD-0005QD-7R for linux-f2fs-devel@lists.sourceforge.net; Thu, 10 Oct 2024 04:59:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:Content-Type:Content-Transfer-Encoding: Date:Message-ID:In-Reply-To:To:From:Sender:Reply-To:Subject:Mime-Version:Cc: 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=kDPmTXhPX6cxQzuvSTnQ8wrHQwVwp7TSgQJ6vfD5NDg=; b=VDAd33uMWMookaYmHPR8Mg6Dmc cyHhFV1A5tcUKh7+MFNNy0nVJ4gbiZKM7ZumNUhcRoGE0lkhjaHx4EVJmjhM2fIGkYV30p/RhuxP2 5LD37f6YgtzhMzqy6/C1yUekJrOc2KQ2/0Qt/6j4bLuhNIEuPMBFKfZLUkLJBYONKgIw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:Content-Type:Content-Transfer-Encoding:Date:Message-ID: In-Reply-To:To:From:Sender:Reply-To:Subject:Mime-Version:Cc: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=kDPmTXhPX6cxQzuvSTnQ8wrHQwVwp7TSgQJ6vfD5NDg=; b=MYPKTI/dNHlJQ+fJbW2Rdd/AMN bae9/unU5olPzehQHSAE/4LOUznnTg2gkGO77ebZ9r0uYY5d0PlL7FY1fIImkuipP3dM6oimMeYvU iLfBgu14VzxQLaESNfkEd5a/0A6+ubI7J+KLwUtCyp/mOzhAFBQc5GDX7VtxBN5+gnZE=; Received: from mailout2.samsung.com ([203.254.224.25]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sylHB-0007Tc-6w for linux-f2fs-devel@lists.sourceforge.net; Thu, 10 Oct 2024 04:59:50 +0000 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241010045936epoutp02d1f203aea4a5afc396187ad85dd82839~8-q06s5IF0894008940epoutp02B for ; Thu, 10 Oct 2024 04:59:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241010045936epoutp02d1f203aea4a5afc396187ad85dd82839~8-q06s5IF0894008940epoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1728536377; bh=kDPmTXhPX6cxQzuvSTnQ8wrHQwVwp7TSgQJ6vfD5NDg=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=f5ULp6EpU2pFt/uhR450E/XBce8kPbtb8U+DPMSMKtB4Sk5crkFXWu33dB2YK1ArE OoeAZ2LUFf7WCqIL5wj8QjIunbP3Pkzb0kcxGzcbPq7FGST+ot0Pa68M2XmWS3+XS5 1Fg+EAolZUCf8OQszRsGxF1Denco2p3cjMWQIFzE= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20241010045936epcas2p2c75963a640c770267156f4a7902f055f~8-q0k7RzD1895418954epcas2p2w; Thu, 10 Oct 2024 04:59:36 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.101]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XPHc7604Vz4x9Q4; Thu, 10 Oct 2024 04:59:35 +0000 (GMT) X-AuditID: b6c32a48-7f9ff70000002653-fb-67075f37b5f1 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id D3.51.09811.73F57076; Thu, 10 Oct 2024 13:59:35 +0900 (KST) Mime-Version: 1.0 From: Yonggil Song To: Yonggil Song , Chao Yu , "jaegeuk@kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , Dongjin Kim , Siwoo Jung , Daejun Park X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20241010043123epcms2p2ad514eb5e4a94413d8b26aea56f772a8@epcms2p2> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f@epcms2p7> Date: Thu, 10 Oct 2024 13:59:35 +0900 X-CMS-MailID: 20241010045935epcms2p7ab5f54e9789b36ea496abcb100a7878f X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpik+LIzCtJLcpLzFF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f5PD6vu323nucSdVFRxU1HFWr1Js1a7LhuqZFW 98SnX3LOMC5/EfT+w/TXee+6edcxpub7hCds1/7o7tB4eVGpDm/tg+srAsPd4s7dX9ntqbil zeLnPyWW4oxEQy3mouJEAICP38MVBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303 References: <20241010043123epcms2p2ad514eb5e4a94413d8b26aea56f772a8@epcms2p2> <20241010021506epcms2p21d877e3c72389b41805db31f391d2b42@epcms2p2> <20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p8> X-Headers-End: 1sylHB-0007Tc-6w Subject: [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: , Reply-To: yonggil.song@samsung.com Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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) + usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg)); + return usable_segs; #endif return get_sb(segment_count_main);