From patchwork Thu Aug 1 09:18:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangxirui X-Patchwork-Id: 13750049 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 D7578C3DA64 for ; Thu, 1 Aug 2024 09:18:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sZRxX-0000cR-QK; Thu, 01 Aug 2024 09:18:55 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sZRxW-0000cA-3v for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Aug 2024 09:18:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xEZrSgpkopwBEyY/ie8+yzygZwxeaTm2ffGreL/Rv20=; b=lmeli3s/VK3FDrYg+LSpTMsAo8 k++dSc7F6GAWh8cq7yHpNoMaMQdlgFod3t6ul3kvP0+rnYwbMjoeBWW0pcefCv+CfXl3yc1Qlw5ES +kI2TwRcM1SM1em4rpUB/iFaO2lNajBmDE8T1Jsb/J6umik/Fvbdk5AYDy+uyopjJFmQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=xEZrSgpkopwBEyY/ie8+yzygZwxeaTm2ffGreL/Rv20=; b=c iEk9Vthu1ChGR5YL57/FE3vl0pbWaV/4gEVHhcehLZGBvRsPHVT3rqz16iqcd4O2LfTmm4RFT3VkN kba3H6+avupCXTtT9DI10rnMEQnnflT1Fa69CaBQ//EqsKNLLxGwtKe6CyngX9th3jYsO9MaPK1uM 4L4aiVgUUS3gbecA=; Received: from mail-sgaapc01on2061.outbound.protection.outlook.com ([40.107.215.61] helo=APC01-SG2-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sZRxV-00004q-5O for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Aug 2024 09:18:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RR3Ta0en6B5rw54xHlpvVLNKLu3Hp5MZE0uS5+jMacUlspfw//BNtVmVP8i6PltoXeek39GVy3MDS0VZB7Y1TNTgmuYaK/TDWak4dVFuK1+a2GXyBp3nFDDGwDqBxIu21k6T64okv3VuvjEKSTNwvaXw+Pdbf8Rrql+VB74rc3Z+kttZVSy8W8eTf6PTwaTueUoC78oqUcgT/gudZZ02G47bJ13y0YQzk7+M7M62sj0B1Sz5MjYcnpd/AKyRp/8kC5TMdyG/jsBGMbZu177d7y8dWzCWaWTdphNf5IYoU2j+2xXKPCiAfoxcVA7Y+08bv2IYb3jmRZ5eReJc/nvT0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xEZrSgpkopwBEyY/ie8+yzygZwxeaTm2ffGreL/Rv20=; b=jOSLFpjNgXq7YBWQg9vYipGmybhehxODPazzHxK21DuqYQrs77Bfzy8FLWWR9CHJMxb7m2sMIU7q+Ho6aUn4PR/7ye/4G4BaaSKU6NECbqstEASXLi5kvdIkne321YnsvQ4BJNG6tvBXkPNO1cQBDESPNR8kz7dIUjM6mJm0k2pliO4exEH5S1e23d0uS6RWkeXxI0xuX1M0NPM0wq5dLwUav46qWcJs1ytfMENGsEl2CYyP0E2bkk/Gf49vPbQooTK/kxhBvqGiExlZ2FWFrXkieNO/jJQqimZ6gHASomw60ocBFKZRERpPI0sS5Dcd5BJQ9hzNk9yLn9qpUkuBtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xEZrSgpkopwBEyY/ie8+yzygZwxeaTm2ffGreL/Rv20=; b=TBmxMgkhl2I8tTLt+R7aIDOzlyaie/zg93fYCWHsEJyaHfNq3fgKhqJk5MoOAc1YZhuf9nIaPT3XvuyaTMksshRKDgjJQ0cG7sd2ShVRJ8/fNhFe6zsqJPtKn4SynuJZD3nHcSMINzeEMg2xBZvrdelFiWcaEB5BZT/SNbHC9UAdobJnxKWkiapI0vonauUpxMreX3gtAIdCpMH7JTIYm2i5Lj7na0Oi9eagfIJJ3TplvKsBHy6B7XgyDIPqYdILzwum7K2MjeWDKjdj6oR1WscCwztE+PMdkDgzZ+6MnU+ynRgd7snpVmuQ6HnuLfZJNM/XtTR4JOiynZAbg3t1Vw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5178.apcprd06.prod.outlook.com (2603:1096:400:1f7::12) by TY0PR06MB5441.apcprd06.prod.outlook.com (2603:1096:400:32e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.27; Thu, 1 Aug 2024 09:03:51 +0000 Received: from TYZPR06MB5178.apcprd06.prod.outlook.com ([fe80::f6de:c016:c33a:318]) by TYZPR06MB5178.apcprd06.prod.outlook.com ([fe80::f6de:c016:c33a:318%3]) with mapi id 15.20.7807.026; Thu, 1 Aug 2024 09:03:51 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Thu, 1 Aug 2024 03:18:22 -0600 Message-Id: <20240801091822.3853678-1-xirui.zhang@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) To TYZPR06MB5178.apcprd06.prod.outlook.com (2603:1096:400:1f7::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5178:EE_|TY0PR06MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: 6242d77d-4e3a-4883-2659-08dcb208dce6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014|43062017; X-Microsoft-Antispam-Message-Info: juzSiTlsNnbgo3O17bztuPvBsrV00kNbY4o3aOes5kNF3ao7db/a7J6Hd/+ciD5+nEu+o1j0YkbbQ0qvcWqs+S5JXP1HoH/OoaACNwcEt/X53xS7ZUKrlXOy9CM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pCZi8NzRvvHveUKVJVKzgm1fjpwymvrZYiYvdbyd7R1NIO3EjAz8HT0zhdXzAZrF8JFtdyCpnWV9wJImWurhtG65cwFUMOgFeyKJ9f//FnA5/xxB3rKxClAqist4dOwF7id7NJINasH7HXcrVkDt5tL85p3JP4Ryt4usioC8UFVSoCSLUpLlqOlbB+3lVO+cVXAdZgLSlCSXNgWO01kiHqrsBR60DJn5O7Tsg4W1O97e3pbcpe5lDBFk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB5178.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014)(43062017); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3I9hMeOGtTBnA+l3xv8Vw8BpAFJsw4LkEZ/LTROA3bTH04caD3VuPOv2HMCVYPMuDY4lR0jliwYh6+ZjBRyvi6IlqwXhun6Y2oPPAbgCVDpSQM7qqjEEhwAvHVS1+vyClSa3CXUtBAEX3UrT+4y+F5KPv5yD+iK6rzVjor668ieTWTzLq70HiReDax1trwr2j/3ACrC5oFr2ofkxi8tccujwp7dTPeFZ+0rY4LUFakoTU0E0wKxBMZHBXkXVbpAZl3sYKzrq7NZePhT00cj+WjwDRxgUDzIxsSQ9Q0RymlvYGLy7HK82ecNBQi6AmHLFa8+TfRDByyo+gcwr8aFKW8V11HCgIKPmikC+/GCI8flf3Gj4wjsqXrK+SkRyc0YQy7pQ/uhnieWxy/usobn6sRQF66UlmUrpYLODvgktbgH3n+jGs+ODtWAGn5MR5niJzFTgn/W/uG+pIUwFY1iUZ7nVCP9nnFJiHn1mum96YLwFRcEJEF0Y5lFlEgbPWPCFV23r3KlSovTBK1dRaaf1334KP9leWP5SjIf8wH//HGhhCtpbCpzMxVhd9SJVyfFGdrPKlNo79cXeBIMfBzXw+D3c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ce6 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5178.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 09:03:51.7180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3MHs2Z01yHgPRKYig7XLlR/N40qLR4vD5Q+G2JQWqGJNYE+4EhJkMRfYLmIf9wXleDZeAiRxyc/DIFERP1EEow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5441 X-Headers-End: 1sZRxV-00004q-5O Subject: [f2fs-dev] [PATCH] f2fs-tools: reduce overprov_segment_count set times 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: , X-Patchwork-Original-From: zhangxirui via Linux-f2fs-devel From: zhangxirui Reply-To: zhangxirui Cc: zhangxirui , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net If overprov_segment_count < rsvd_segment_count will set_cp(overprov_segment_count) twice, reduce it. Signed-off-by: zhangxirui Reviewed-by: Chao Yu --- mkfs/f2fs_format.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index e26a513..794ced5 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -764,10 +764,6 @@ static int f2fs_write_check_point_pack(void) get_cp(rsvd_segment_count)) * c.overprovision / 100); - if (!(c.conf_reserved_sections) && - get_cp(overprov_segment_count) < get_cp(rsvd_segment_count)) - set_cp(overprov_segment_count, get_cp(rsvd_segment_count)); - /* * If conf_reserved_sections has a non zero value, overprov_segment_count * is set to overprov_segment_count + rsvd_segment_count. @@ -787,8 +783,11 @@ static int f2fs_write_check_point_pack(void) set_cp(overprov_segment_count, get_cp(overprov_segment_count) + get_cp(rsvd_segment_count)); } else { - set_cp(overprov_segment_count, get_cp(overprov_segment_count) + - overprovision_segment_buffer(sb)); + /* + * overprov_segment_count must bigger than rsvd_segment_count. + */ + set_cp(overprov_segment_count, max(get_cp(rsvd_segment_count), + get_cp(overprov_segment_count)) + overprovision_segment_buffer(sb)); } if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {