From patchwork Wed Sep 18 10:06:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: patchwork-bot+f2fs--- via Linux-f2fs-devel X-Patchwork-Id: 13806754 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 D7496CCD194 for ; Wed, 18 Sep 2024 10:06:54 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sqraI-0001P7-HA; Wed, 18 Sep 2024 10:06:54 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sqraF-0001Oz-Fi for linux-f2fs-devel@lists.sourceforge.net; Wed, 18 Sep 2024 10:06:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From: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=UvjIKAs63k4GEfsyoW2G7eL76dNHG88P32YxnjAylLU=; b=V3I9MzyWx2vBJ80nb72BvAHomz BM70lPH0TecIk3zc4aisGnpBY+D/4VLJi5zPd7ShJr9fRhM9x3ypaFI6Boozku8HCO4GBuF84QWzP 7veAPrlTLE4lmkxWXStueAAWdA5Y3Xya3fi+k6mPHEqt7hnZKWhxY1nGhoJlUeQa8UnM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject: CC:To:From: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=UvjIKAs63k4GEfsyoW2G7eL76dNHG88P32YxnjAylLU=; b=PlfMQPRihjE9d34R0ZmiYiRNe9 s99lCSa3WL9a32VyaFiToxpDXC2EwpVIFsMDmsqnN9YbexzRx/1OCfkDLGOHNVTXQZw+5zHc1DxXw stBFcEsgr572JtRKOtrC1l+DZRfRV3jGi/DAyceJ9y8XRQCCYPCqCFFj4aQPYXW7APfE=; Received: from mail-psaapc01on2065.outbound.protection.outlook.com ([40.107.255.65] helo=APC01-PSA-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 1sqraE-0003hu-OU for linux-f2fs-devel@lists.sourceforge.net; Wed, 18 Sep 2024 10:06:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G0Y8BhshT9hq3+thbQKz7GwpoyYCOlAQgMRTOgU4OLNBCl562w7fKePXPIwJ2swrbOA5DXKwS/5W3kdomJ4GUjYTaEqRAXJd/kv/9W1qNMSgcf0uFHdp0FB7wDsbGHqeRaXmmyz6+48hgvBu+epesYxhCrQTqMve5LDuQPnXj2AsmZER5zcPOfGiAPn1RLuIzXPgzlkNRmdfySV1+whpODOBXsuF5ofdpfWUngIgprTHA0vs7pyhgdIbUwBhaatQ56hiHS65A154C7NfiIGzt8G/BGADdKN758s95fQ43QUAF+p0TtNW2XSqKejplFgFj5Y64O38Co/2JRRiFuLKQw== 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=UvjIKAs63k4GEfsyoW2G7eL76dNHG88P32YxnjAylLU=; b=f7Q1Igl7TDgc0bzWug4Lc01ZUYYvLJdJNkhplsIM0gFxyMXVkkkPqJar55oTerOsWBWFsoqjxIHVhNxHVMwepMeKQjIN4qq9Kjj7YKC0tsjJZmatmp4y5eGT1JwB3PPB2sIWLsW6dIpPXPy3LSqBvn8bI4XP/vNG81MrEbEiWHTsex/IL/p+NrASOWssI2XY4VA+vv2kmRP7fIkkkrrSqDmrgmGmFQkUrd0B5iGVeVJBLbeIlwNQPK1wtL9zLtQpLAIMuzUGX1RN9Jv0KspH6onjY6Df5i1Puw03GyR5rYWUQGBKeaYfEBSOqrDrlSKU9ECW5faRw/lPEUL8h6dmfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=kernel.org smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UvjIKAs63k4GEfsyoW2G7eL76dNHG88P32YxnjAylLU=; b=buHHb1PEN3Sdkl7bfjWkf1j/QWMWSjBAHzvhFdz3AsjD+gu6HbpXza+2WhPtM4QofZ73+ce9muVfiCR17+yuKO8cYbzGTk6KEskmBytFYl4mjsmI5Ucft2zt1pgmeyWF5x0AGJV6+/q9WwkW7irD+xN7tFH0wd9b+J7v2Xozidg= Received: from PUZP153CA0008.APCP153.PROD.OUTLOOK.COM (2603:1096:301:c2::23) by JH0PR02MB6544.apcprd02.prod.outlook.com (2603:1096:990:17::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.16; Wed, 18 Sep 2024 10:06:36 +0000 Received: from HK3PEPF0000021E.apcprd03.prod.outlook.com (2603:1096:301:c2:cafe::53) by PUZP153CA0008.outlook.office365.com (2603:1096:301:c2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.7 via Frontend Transport; Wed, 18 Sep 2024 10:06:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by HK3PEPF0000021E.mail.protection.outlook.com (10.167.8.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 10:06:34 +0000 Received: from cndgdcavdu0c-218-29.172.16.40.114 (172.16.40.118) by mailappw30.adc.com (172.16.56.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 18 Sep 2024 18:06:32 +0800 To: , Date: Wed, 18 Sep 2024 18:06:19 +0800 Message-ID: <1726653980-590956-2-git-send-email-liuderong@oppo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1726653980-590956-1-git-send-email-liuderong@oppo.com> References: <1726653980-590956-1-git-send-email-liuderong@oppo.com> MIME-Version: 1.0 X-Originating-IP: [172.16.40.118] X-ClientProxiedBy: mailappw30.adc.com (172.16.56.197) To mailappw30.adc.com (172.16.56.197) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HK3PEPF0000021E:EE_|JH0PR02MB6544:EE_ X-MS-Office365-Filtering-Correlation-Id: a53f9e70-c2bd-4e09-5145-08dcd7c993fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: 1kOFA+OAv0zdS9ta93GJM2pQMSWBdziWxSr+aefpJ5jSvOcVUrbMY5cUy2PoEAJ8a5Z/fTNUWJQwn3X5R51P16GTOXcA/Wip3VJmpg47P74cI4kn5hmgxUVI/C6rtqhmCrDqNEX9C+WFW0XB4lseNbjJTqPg7S6O/bs+ji61KuB5jEWWyBc/MHBuAuCFZBiqFi617n0DKshoeKFaWdGQl3+QVrb8z43wng5BCFKnjzhvTV4snE5JGJXNxpnCsXtdy419lRiQeI3iX5gQttqYa0KNwV+koEfV2A51DPvLvu/vZywX/knk/zAHX9KGdR7jSRp3lqVbX4XIPin7WIUoaujhMW7i6Fx0TG0/TB7XtJLkd60ba83/TLlazHWP2IMieEgez10Ek3EphIEcyL5Jx/LI8sUYR8Ift8G5mPPfLMo/7RQchGlztd1WkNmRxBorkgTNeAqB/AOr9WBBb/oIs1iLtql8pvZ8M1D7LFjZa/o8EgWVxICJdK08Hn1w31L+5jIddQZ1SLX7tKO3BLCfO313gmVqZkszD54u9Seudw41gTNqG20dl01klHyOkxpMy8SaYQm5is7fllJzgV7iU5KADR86u//ydh23/d54UA0q7TtuxF9kBglJ1F5Y4eSBarcdeJxTDGuuHn1TaA7l1HfeEN/5plGfP3ZsfTNBoPbI+4CE16qv63Zc1qSJeBMI/c7NkOuLmU9JEWEcolyI346QKkY/k55rUmFqavxi+FZAYDlYhuUFAQQP5cRQIaPBLdUHDHDzweKr+iNHgEwleqs+QBmmkPhVGuPFqhbWZrKNilzc9+rof/Mvhp/TST20hueM/Pg2XyskjeAzwSWOYMtYnWiYadwN2dbWaJqymycvQPHj5z0SFahUOFeZJ1W8qxOGOODMkY+94CFfLl1kL/WiYTDTIehAzKlwBaibrWheBUfpesCIDrb647LJuD/EsdQGZvJfCEEQh8+l8Yl2DpGKdHricpNi4or7ZKYV0cYZz5iSH2yfPYySnU+kr7SOp4d2UqbdecIwmgDlm30u8YvmrXjXvnPLGvV8WiUuM2vAyrBpEabqCuZp4YEig4VSAXXUxWeoomci0DXF/QqzBulCawaubt4l0QY10wegAeZNtnX5R6UTLouES75//aBnu8Ot8v/5RcOfsTkwrl/BFxxN92uZ7AcjWleSxh+YE/jh4o9kXkgkBx8U57D+dkbvMyVcG6AouozmKSN43LuoMZiCfgQ4EOLM+SNcr7Cfxhdszyz/uGL8ttK8lbB3p+WKjow/HB/8iwHIMuepUi3tW+1zMMpR1XGEQhwnLJ75obsPqaM1l3ks0SotQglbCzDdnbxJuD0WO2oJ0SIebymqHxtCILTidcEC5PoI3MBmH7Q= X-Forefront-Antispam-Report: CIP:58.252.5.68; CTRY:CN; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.oppo.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 10:06:34.3830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a53f9e70-c2bd-4e09-5145-08dcd7c993fd X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6; Ip=[58.252.5.68]; Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: HK3PEPF0000021E.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR02MB6544 X-Headers-End: 1sqraE-0003hu-OU Subject: [f2fs-dev] [PATCH v3 1/2] f2fs: remove unused parameters 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: liuderong--- via Linux-f2fs-devel From: patchwork-bot+f2fs--- via Linux-f2fs-devel Reply-To: liuderong@oppo.com Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: liuderong Remove unused parameter segno from f2fs_usable_segs_in_sec. Reviewed-by: Chao Yu Signed-off-by: liuderong --- fs/f2fs/f2fs.h | 3 +-- fs/f2fs/gc.c | 6 +++--- fs/f2fs/segment.c | 3 +-- fs/f2fs/segment.h | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index ac19c61..4dcdcdd 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3759,8 +3759,7 @@ void f2fs_destroy_segment_manager_caches(void); int f2fs_rw_hint_to_seg_type(struct f2fs_sb_info *sbi, enum rw_hint hint); enum rw_hint f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi, enum page_type type, enum temp_type temp); -unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi, - unsigned int segno); +unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi); unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi, unsigned int segno); diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 724bbcb..6299639 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -339,7 +339,7 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno) unsigned char age = 0; unsigned char u; unsigned int i; - unsigned int usable_segs_per_sec = f2fs_usable_segs_in_sec(sbi, segno); + unsigned int usable_segs_per_sec = f2fs_usable_segs_in_sec(sbi); for (i = 0; i < usable_segs_per_sec; i++) mtime += get_seg_entry(sbi, start + i)->mtime; @@ -1707,7 +1707,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, */ if (f2fs_sb_has_blkzoned(sbi)) end_segno -= SEGS_PER_SEC(sbi) - - f2fs_usable_segs_in_sec(sbi, segno); + f2fs_usable_segs_in_sec(sbi); sanity_check_seg_type(sbi, get_seg_entry(sbi, segno)->type); @@ -1881,7 +1881,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) total_freed += seg_freed; - if (seg_freed == f2fs_usable_segs_in_sec(sbi, segno)) { + if (seg_freed == f2fs_usable_segs_in_sec(sbi)) { sec_freed++; total_sec_freed++; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 78c3198..6627394 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5381,8 +5381,7 @@ unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi, return BLKS_PER_SEG(sbi); } -unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi, - unsigned int segno) +unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi) { if (f2fs_sb_has_blkzoned(sbi)) return CAP_SEGS_PER_SEC(sbi); diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index bfc01a5..9e61ded 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -430,7 +430,7 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno) unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno); unsigned int next; - unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi, segno); + unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi); spin_lock(&free_i->segmap_lock); clear_bit(segno, free_i->free_segmap); @@ -464,7 +464,7 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi, unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno); unsigned int next; - unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi, segno); + unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi); spin_lock(&free_i->segmap_lock); if (test_and_clear_bit(segno, free_i->free_segmap)) { From patchwork Wed Sep 18 10:06:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: patchwork-bot+f2fs--- via Linux-f2fs-devel X-Patchwork-Id: 13806753 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 0C56DCCD194 for ; Wed, 18 Sep 2024 10:06:49 +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 1sqraD-0006X5-HT; Wed, 18 Sep 2024 10:06:48 +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 1sqraB-0006Wx-Cq for linux-f2fs-devel@lists.sourceforge.net; Wed, 18 Sep 2024 10:06:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From: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=Wa018P/VMM0X7XfBlCnyHnJB5rHoQ3mlw+k+GS+4exw=; b=OV3uh63HswXPaMX+oCjdz51UXQ jQud4H6S6A4j7ZrBh+BiCC8ZDJrAoF8CWd0nJ26tiyeOU9qj9/qUFJqiGCy7n91/4hpEioBRiHrXh 7VnRFF7ItA7khwChFdMJpFGPSu+YqSoWzJbPQvYWrrMe2EY2MCwxyNzSlO41HO1CdoeM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject: CC:To:From: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=Wa018P/VMM0X7XfBlCnyHnJB5rHoQ3mlw+k+GS+4exw=; b=AtHOdaQj3zbjkQQ8A+N9rs7yPL PGvhXVymliCDt3ICkLo1xNCNaNdbbEapXKvGq4f6oKy1owyT4vZKHHeoNa5Qk5ZwvUgwUgeH0MePr dAyXLqbRu+99MhNZipq1R1rV0hMFUjQhYbAmU7EZowH19cCkWucgK6TAYmh7/DtkJcbc=; Received: from mail-psaapc01on2055.outbound.protection.outlook.com ([40.107.255.55] helo=APC01-PSA-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 1sqra9-0003hm-W0 for linux-f2fs-devel@lists.sourceforge.net; Wed, 18 Sep 2024 10:06:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WPh1Tldk3jBV+DA58MegU4rqpyJIe/t8bXsL8fXxNjpjl93b4SdrNwuduyu5eM1F7yjFHa6h0p88JiUEOFXvzU5Is5FlX3R/m4e1ywdBh2bjTF7PYY2l+uzv+ABO+Tg5eNbUroJ4T/8ebgMz6iU3nwpZC4YIq8USy5tg7ssEz1OFfHS7BZstnRmFAGKEX47ci0JvXNU2YH3gYeKKfKESOT6ixd6XtwVnh3ryCdKwe+0Qf0HNtVCqKREtTS8O2uQisLOyRqiQWtrLmASQIm/++nIoT1O/clr5vWZ96hUEeSEbfPxzZVfSNeKCRtrHmT1Fi3MTo+6tOL/BHvCiJmqrtA== 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=Wa018P/VMM0X7XfBlCnyHnJB5rHoQ3mlw+k+GS+4exw=; b=k94ZTOQImwhckbGWb9bqGgrptysFCHv9acmK76abXKm84oHEt9ZiFBmag7QtOMQPHfYUmoI0ivKh3UJyXlc0gzzhe9WeBJ3QtylxQ8+Lv10B0k12JMa+aT8mLqfIDB5k39+9ZmGoMqqvDM/aO8LbGepNcOjI6mf4ZEXzrftW7EGUZdxKHYSeDnzE/bBMg8ZAT9BgNZ7T1fYwmT0solVtZoGWIPizGY08qFOZ7GYZGQz4ISXhV6PSQjg67XgIwpkQNwVRiqYA01mCl32/suhQ6FpB4SR9WYwzu3vaiZ5oc+E5rKl997krs8wdahmfXQpCQ2YSljv8Ylu03zxvmDZZNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=kernel.org smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wa018P/VMM0X7XfBlCnyHnJB5rHoQ3mlw+k+GS+4exw=; b=Trya8S7s8dhsq2CaBBqBVYL+cfGPSCvWpLh7lpnugCxHNCMeinKf7wvD/gPmGMadf9PZjb3RHvv3E25exDD00StBI2h2DGXajh85RNFZy1iB/lUMqa0WuwEobVqcKlOjdQ4mqRjXqpHVeapV1OPalTErjgvKXp8SZ95ZyZM+P5w= Received: from KL1P15301CA0027.APCP153.PROD.OUTLOOK.COM (2603:1096:820:6::15) by SEYPR02MB7458.apcprd02.prod.outlook.com (2603:1096:101:1e5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Wed, 18 Sep 2024 10:06:35 +0000 Received: from HK3PEPF0000021F.apcprd03.prod.outlook.com (2603:1096:820:6:cafe::3b) by KL1P15301CA0027.outlook.office365.com (2603:1096:820:6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.6 via Frontend Transport; Wed, 18 Sep 2024 10:06:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by HK3PEPF0000021F.mail.protection.outlook.com (10.167.8.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 10:06:35 +0000 Received: from cndgdcavdu0c-218-29.172.16.40.114 (172.16.40.118) by mailappw30.adc.com (172.16.56.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 18 Sep 2024 18:06:34 +0800 To: , Date: Wed, 18 Sep 2024 18:06:20 +0800 Message-ID: <1726653980-590956-3-git-send-email-liuderong@oppo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1726653980-590956-1-git-send-email-liuderong@oppo.com> References: <1726653980-590956-1-git-send-email-liuderong@oppo.com> MIME-Version: 1.0 X-Originating-IP: [172.16.40.118] X-ClientProxiedBy: mailappw30.adc.com (172.16.56.197) To mailappw30.adc.com (172.16.56.197) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HK3PEPF0000021F:EE_|SEYPR02MB7458:EE_ X-MS-Office365-Filtering-Correlation-Id: c550fb92-35c2-4564-3dc0-08dcd7c99420 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 7IGyNTQRVzVBfeNi+uKMMqS3hnia/cP7RXA3f7MW+0/irD93SzzwhAQ8o0zLFnsjk+teAkmDmSWdwtDca0w/B0Q4G6apuUh1CcKXOyStLw20C9oym0SKaZmNoQxfHIMYWecOn+NaET4p847Lsusyoq59kI4ORaK6ufsjsQ2crziUt1fYKQtwvST+Hz7d/Ed0f9Mr4TEa5fkU2LCzvm6q444CuOUsVPRNy1PPLTN85FqeXk/b2bnFcDMUw4Rm+QAWONEvZT5qhuJFovCiGjyHoDkAVyNf2W18E6GT+daR3XdOgJZDxBbh7GgdJL3oI7YsI4LUJafAh9zBO7rV0PIvHzK/UxbXcg9coo7h59K8EsF3oahAErC7DE4WWW3vHifNVWRQ8Z0/TkyNJ4uRQGjrlJVasLBdY2TR5wUhP95rz057O6DgJ2oISWZ2es7w5yXHlyRTpUgiNcXPccpitJSx3TD5O7cVUJ0O1pMjDwsbuaAvbtVH+oz5RB5rtXctzIMXQNeYFWcoMTjWfISUnZGEEyNltx00avYDH51fyI8RCUfc13dWL32O0col7qQRcb/WHw9ymintQkktFO3+7tE/4K97WCeWzYWW0IjmnGAzKK/+xvk/LbG3mhdswPc5kC9cbWdenQvXq/AbQ9ElMgW3luvVv884a3KvL0TUBcaFnyCBCa3VOOpyWMRBnZP2dxKCSm+aPOy45MPgwtCnYlPkgeR1hAcwR9XaCAIhz2oNBAD6Na5enBctrE1K+7K6WukbwBZ7T2CjYviAMcFOttk3N2DLzxS3/+3tpLoqXXkLxYYHJ9qaTTAq03LVyVVIyNMWqPvonEARfBm0HMgStC0Mu5JaLOhpT4G1lBm3M9uuz4tKJBvA8PUmOaHiwzI/XmcXKQvvDDjFeybV6TMttR2ePumacudvBkMzONMi7OX3+S4aG/0tntDPVK7RLDDmESsA+cSKh0zVILlgF8NLZB9BBfSnlpB5xY12E2AwUEvm64pw5ElcJ49PSwjb2DqGk4jV71lP8EdrtiSUy5e1xcmJtnNvJTXax+MRgOb2jAOrM+pARJjL4I3V+GlVq5vwIynaMUCZ6puSjPpEPBu6bG0SnPeyBQ3TBJfC93PsxiJPLhD7qwfyoRe3slxIu2HuTbB03iRIuZ/R+6csmGx+qeQCK/8ud+0jzR1m2xTNepOrAWBii9nOGQMsbnn2hNfRltoIUww3fRKyGzbz63x5hFchi7Xu7HHYYNeAMqlFaXPOHG1syQ1Ok3HlM9SdT2t8N2iDKpU8ye2KhGqSpW90KVf1QbogcuwaFEl7+FE2cQQsNySbOQW1xZJMCLzygpWrknj76pv/2xtvcr8DhQfsc/taDvPm34T78v5GO34vGV1AIHQJAnKOI4ke+HH36OY3c+h0w19Kx8tpjvdzK1B8qoCmPVmUORsZWOBZYyOcZjSjY4jdZqASHbBXb9p5U3hiMJWu X-Forefront-Antispam-Report: CIP:58.252.5.68; CTRY:CN; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.oppo.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 10:06:35.1588 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c550fb92-35c2-4564-3dc0-08dcd7c99420 X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6; Ip=[58.252.5.68]; Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: HK3PEPF0000021F.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR02MB7458 X-Headers-End: 1sqra9-0003hm-W0 Subject: [f2fs-dev] [PATCH v3 2/2] f2fs: introduce f2fs_get_section_mtime 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: liuderong--- via Linux-f2fs-devel From: patchwork-bot+f2fs--- via Linux-f2fs-devel Reply-To: liuderong@oppo.com Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: liuderong When segs_per_sec is larger than 1, section may contain invalid segments, mtime should be the average value of each valid blocks, so introduce f2fs_get_section_mtime to record the average mtime of all valid blocks in a section. Signed-off-by: liuderong Reviewed-by: Chao Yu --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/gc.c | 17 ++++------------- fs/f2fs/segment.c | 35 ++++++++++++++++++++++++++++++----- fs/f2fs/segment.h | 2 ++ 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 4dcdcdd..1c140ff 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3762,6 +3762,8 @@ enum rw_hint f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi, unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi); unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi, unsigned int segno); +unsigned long long f2fs_get_section_mtime(struct f2fs_sb_info *sbi, + unsigned int segno); #define DEF_FRAGMENT_SIZE 4 #define MIN_FRAGMENT_SIZE 1 diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 6299639..9ca73bf 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -332,20 +332,15 @@ static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno) { struct sit_info *sit_i = SIT_I(sbi); - unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); - unsigned int start = GET_SEG_FROM_SEC(sbi, secno); unsigned long long mtime = 0; unsigned int vblocks; unsigned char age = 0; unsigned char u; - unsigned int i; unsigned int usable_segs_per_sec = f2fs_usable_segs_in_sec(sbi); - for (i = 0; i < usable_segs_per_sec; i++) - mtime += get_seg_entry(sbi, start + i)->mtime; + mtime = f2fs_get_section_mtime(sbi, segno); + f2fs_bug_on(sbi, mtime == INVALID_MTIME); vblocks = get_valid_blocks(sbi, segno, true); - - mtime = div_u64(mtime, usable_segs_per_sec); vblocks = div_u64(vblocks, usable_segs_per_sec); u = BLKS_TO_SEGS(sbi, vblocks * 100); @@ -485,10 +480,7 @@ static void add_victim_entry(struct f2fs_sb_info *sbi, struct victim_sel_policy *p, unsigned int segno) { struct sit_info *sit_i = SIT_I(sbi); - unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); - unsigned int start = GET_SEG_FROM_SEC(sbi, secno); unsigned long long mtime = 0; - unsigned int i; if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { if (p->gc_mode == GC_AT && @@ -496,9 +488,8 @@ static void add_victim_entry(struct f2fs_sb_info *sbi, return; } - for (i = 0; i < SEGS_PER_SEC(sbi); i++) - mtime += get_seg_entry(sbi, start + i)->mtime; - mtime = div_u64(mtime, SEGS_PER_SEC(sbi)); + mtime = f2fs_get_section_mtime(sbi, segno); + f2fs_bug_on(sbi, mtime == INVALID_MTIME); /* Handle if the system time has changed by the user */ if (mtime < sit_i->min_mtime) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6627394..717cd15 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5389,6 +5389,35 @@ unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi) return SEGS_PER_SEC(sbi); } +unsigned long long f2fs_get_section_mtime(struct f2fs_sb_info *sbi, + unsigned int segno) +{ + unsigned int usable_segs_per_sec = f2fs_usable_segs_in_sec(sbi); + unsigned int secno = 0, start = 0; + unsigned int total_valid_blocks = 0; + unsigned long long mtime = 0; + unsigned int i = 0; + + secno = GET_SEC_FROM_SEG(sbi, segno); + start = GET_SEG_FROM_SEC(sbi, secno); + + if (!__is_large_section(sbi)) + return get_seg_entry(sbi, start + i)->mtime; + + for (i = 0; i < usable_segs_per_sec; i++) { + /* for large section, only check the mtime of valid segments */ + struct seg_entry *se = get_seg_entry(sbi, start+i); + + mtime += se->mtime * se->valid_blocks; + total_valid_blocks += se->valid_blocks; + } + + if (total_valid_blocks == 0) + return INVALID_MTIME; + + return div_u64(mtime, total_valid_blocks); +} + /* * Update min, max modified time for cost-benefit GC algorithm */ @@ -5402,13 +5431,9 @@ static void init_min_max_mtime(struct f2fs_sb_info *sbi) sit_i->min_mtime = ULLONG_MAX; for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) { - unsigned int i; unsigned long long mtime = 0; - for (i = 0; i < SEGS_PER_SEC(sbi); i++) - mtime += get_seg_entry(sbi, segno + i)->mtime; - - mtime = div_u64(mtime, SEGS_PER_SEC(sbi)); + mtime = f2fs_get_section_mtime(sbi, segno); if (sit_i->min_mtime > mtime) sit_i->min_mtime = mtime; diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 9e61ded..e7ff51d 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -18,6 +18,8 @@ #define F2FS_MIN_SEGMENTS 9 /* SB + 2 (CP + SIT + NAT) + SSA + MAIN */ #define F2FS_MIN_META_SEGMENTS 8 /* SB + 2 (CP + SIT + NAT) + SSA */ +#define INVALID_MTIME ULLONG_MAX /* no valid blocks in a segment/section */ + /* L: Logical segment # in volume, R: Relative segment # in main area */ #define GET_L2R_SEGNO(free_i, segno) ((segno) - (free_i)->start_segno) #define GET_R2L_SEGNO(free_i, segno) ((segno) + (free_i)->start_segno)