From patchwork Thu Sep 12 06:40:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuderong--- via Linux-f2fs-devel X-Patchwork-Id: 13801478 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 73E23EE57C7 for ; Thu, 12 Sep 2024 06:40:45 +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 1sodVV-0007xT-2t; Thu, 12 Sep 2024 06:40:45 +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 1sodVT-0007xC-E9 for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Sep 2024 06:40:43 +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=oSsqPVk30Mqw3IyemL0Qad2li3axTIaKLI61/rZwLIQ=; b=O5KIsginXxjf6tNoL+VYfbXZrQ cR1WHPHSpuJLSHU9Yf68c7Wpq4lQ4RED7A98C2DQXbIhJQysHKn5lWskPEfICP3YJA0bqxQlekOLN VpY95fd0B/8MioLXB1VY73lfnNWhvmSV24tzooh8ojIiAXaizN40kNXONj8YCHmw01hg=; 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=oSsqPVk30Mqw3IyemL0Qad2li3axTIaKLI61/rZwLIQ=; b=cJjKLAquo72Z91ShMSRZ+FQGoi gFJiKpx5s/uEJt2uUmJtyqNdmBKbhCl+JexE3vxWpOqen0aJLMPA8Zn5EF7drb25mOmNBQtPeSQbH NbJoyo/9TRk1hTxp8NJFKTAgfnmQ/vfu2Jw+3cRQIBRGUa6wWEyAS69ynKEDop7tEqOM=; Received: from mail-psaapc01on2052.outbound.protection.outlook.com ([40.107.255.52] 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 1sodVS-0006sA-Mb for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Sep 2024 06:40:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X6EoIvg8kML8rZMjcFovTfd0gS6jYXOjklluBiz1t/eZAYjJWURAqBVwfRfV3bLVyW/zI/KEJfQgXG9IqRbWrrN8Btbizx6fjnxdjWTFWmdMwMvbAcfN5Wu6femoYQKrSxu9h98PoScnOt9BHUTMSfzFuHda0eFolESjodtFuzdjPftzQsST91ppzc1L4k9jQEa6tRKvCRBKBvFeVtiZhahojtPyDE5e//6HjuN26ZlR/wh7Xe2Kld8uf4Wow/e8NOquzEXKZ6bfxDs76CTbgy4N45vgMWAp7TvB3ClFDjZxuHhxPDN740mppYlJBKZ/ENNLtTa91sdooBfI3CgPHQ== 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=oSsqPVk30Mqw3IyemL0Qad2li3axTIaKLI61/rZwLIQ=; b=KRaGUYjP7efvHxWKbujUgXivmGD0X5kAmOOLz6x95h/e/im4xyy9mbvokYhOKM7fBdbG9TnYQbTiVfIn3gZsOuic/BrYC89gTjXrovA/Wp5zAyJBJvDwHUi8ruM13Q9RGRiPRR3jdGaII3vM8FaaeGllfssbN0YM71SgTw86BzFYRT0OHtj0dcUu7hz9ZdLULU+OiGDWDAO7H+va7edDwJZGqHJW1+N96GLzAAuc9t73U2PJ3/U5Tpnx3cAMjsSLQrNztMUuQuIQMbbl/HMo8OXf7A1mJAKr5D4Yve2pexOD5+h7W60sHl5L+r3WymG/FMT+Cd9wrvDVSKLdTS8dfg== 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=oSsqPVk30Mqw3IyemL0Qad2li3axTIaKLI61/rZwLIQ=; b=Gr2645xm6Z5QwgN4gbWUEDa9pTsbZNuioQC4ISkL3sMHyPLuHtEEkqgIBoZt0tkX052QRNbYiA1EBoo+NswV7tLdejiR+xhuEeMJoHYALnIoO/EbmC91tPCoRQubuLSJvEpj5irHlp5CMXENzETja0SFRCs7p9oKQrU56tXD1tg= Received: from SI2P153CA0031.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::7) by TYSPR02MB7370.apcprd02.prod.outlook.com (2603:1096:405:37::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Thu, 12 Sep 2024 06:40:28 +0000 Received: from HK2PEPF00006FB2.apcprd02.prod.outlook.com (2603:1096:4:190:cafe::4d) by SI2P153CA0031.outlook.office365.com (2603:1096:4:190::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.7 via Frontend Transport; Thu, 12 Sep 2024 06:40:27 +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 HK2PEPF00006FB2.mail.protection.outlook.com (10.167.8.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 12 Sep 2024 06:40:27 +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; Thu, 12 Sep 2024 14:40:27 +0800 To: , Date: Thu, 12 Sep 2024 14:40:13 +0800 Message-ID: <1726123214-208356-2-git-send-email-liuderong@oppo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1726123214-208356-1-git-send-email-liuderong@oppo.com> References: <1726123214-208356-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: HK2PEPF00006FB2:EE_|TYSPR02MB7370:EE_ X-MS-Office365-Filtering-Correlation-Id: a8f50448-0636-412f-2345-08dcd2f5ca11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: KB9Vb/+sAKJ+OKIHOuJsgg85HodLzDMIsFwcJL7h7kSq9t5ugsz2ZppQBdG9Z3pUuxjvXuPMslaaSf7uslG+8VlZS1sLuCPXkNLpJfYpQuq0Ypar72GCOb52Z2UuW153GJ7/aXkfOOu7IjO3JWxxyCjXl3h6lUK/dBw+oWuBjrKVUmGRGlfA+gjauiuPk725mWbLJ2H6zjNvIPNntGIStZOtlAXKpgaSTdJi/WGJ4gTnubvYdDFIvkv3hCw/qRp95tBfDJGqIbSqoR9FMOgnsYYtpcai51nIfXQoRXJpuuU0MXyGCcFNlz799C6JFttAfZi9CAz1J/qTNQKa7ZUiZ/JfVF1f0HQO2aIgzlSGy1+2aQmNgFv/ViZ2ZZtQT/x4QMEFNJdhAlOvg0bQ8POjwkjF1kfeYjX/NDbtWMzquVjBf0No9RBDvrzJyWRG9HbrQUpdnDZXQXW/kuqWBzMYE/O+c1rASWvnsqTqkJrztC+LT6Q0WzPTXJj3z+HGmZyeJQCcuWlPAILTHgp9SrY/7VxVYpZAuBZD6MTaINl6Ql+cxTGEJ9+BhryQYT1aHa6M69qJrQaFRJjX9az2FfK0F2AUkNXtNgoKR6NLQYJKwdplrtGgXnfG9kkm6bglkN4UiyD8YUJ/Yyw1BlXFjNLTlFiaziiX90md9m+YbCRF9vd2h88D3GCPAw14o+Ki+1jKHH9rjAksjeyQ72kCrWmolmrvRLwkxeflqqdqOl1Jz3aoXwjj/04R9LVXLOZC3cLj8dZw84bLWqK6I1OPX+QWcrW39cFOjGKVBfYvCnpmnNXRSE4SiQeSQZ4hDOHIvGaAtDZiF1Uk2QnZMODmDu50Pxb3h6xqoI1BtG8u2aEVvRmGi5qf5EALm2l0/ZdUSNbzN5BYf6dFWzb7nQ/maomC2FYXVYcff0cb6Z/vpOu+9TifQROS+SyTmr3FGRSMBjr+0HTAeuioJkMjBzZ2mJ3jg+W00ne2WpAJVdsBzBaN/QueU8VmffClJHxB7ew/lPeI8wGnzK/a34dVEivkbVTMF6DT0STunRPBkjybgkZGTTmhiXwcSAgQStN+6miytD5Ow6gnaJGPjaIatzxtpoJeKGGuh9CuGlZKO6grsDgJ1D6qIHohAGaWSB3hiV/GMcfGzM2jdwT+KsRSP9m/5hK+mVqKdSGQDMVJnxY6qkopXL/S9nqI2kvuWtxFVnw4zow9wgckLRsyUP7K7YUTUvkftY3xth19uja+lUJ0LrTdH9uO4xzC/pcHrcVAK8EIknB1qUf1Vc3DhVfIW5/YkFbR00c/s1vGOzCvanHPOoRQx1HnOzfPDaMNEpzQeyl41LSNvEtp8TuYIhmGBt5bE5K/YglU2UCP/0zMcM1tyMbSaS8hmdq4O2v8uIqlA+9C6bjK2e12VPNWvk36usYx2ZLVtrcUBZQmyfoT99S5+ht/U1lwWeVJxjrkwb8gEntSnBBU 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)(82310400026)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 06:40:27.7146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8f50448-0636-412f-2345-08dcd2f5ca11 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: HK2PEPF00006FB2.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR02MB7370 X-Headers-End: 1sodVS-0006sA-Mb Subject: [f2fs-dev] [PATCH v2 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: liuderong--- 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. 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 Thu Sep 12 06:40:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuderong--- via Linux-f2fs-devel X-Patchwork-Id: 13801477 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 35E26EE644D for ; Thu, 12 Sep 2024 06:40:41 +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 1sodVP-0007eS-Su; Thu, 12 Sep 2024 06:40:39 +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 1sodVO-0007eK-6y for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Sep 2024 06:40:38 +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=qhFrel5hVc+QCQ3Zf1JE5M1aC4spplciKDjRVfXbf+A=; b=C6YQ7/FMq4x48frCXD7UMFuPQj ml9EkV3WTPgV+CWGFUInaxxr2i8SkFt2E3D/X46RLyN6dmkwqs5ALLzBMb1PTQm5vrbUEfojbEg7Y L2TzOPBRbsWCvLz7IUMOQABXF4NCtf+uRy54u0Qf+G0qoJGoJmsd5R958hWkLpB3QZ1w=; 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=qhFrel5hVc+QCQ3Zf1JE5M1aC4spplciKDjRVfXbf+A=; b=j8p7auA88AecUgX4ZtoeOU35jW BabsWe+jtW+GtRRL5SrUn7y/j8Vy9GdawlsTdQnNtNpES5qjm1id3yQMR+iDUPCkaMnSg/W9hdNjJ xbh9TAL7izCpmcwRnufpkOxTWTDRH/BIYzgy4TYu1mGW1oIP2TKJ74JIXQLhu9ZMzojk=; Received: from mail-tyzapc01on2060.outbound.protection.outlook.com ([40.107.117.60] helo=APC01-TYZ-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 1sodVN-0006s0-C6 for linux-f2fs-devel@lists.sourceforge.net; Thu, 12 Sep 2024 06:40:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xYVBXfovI4mfQXGsaQc3AKn7JqtQXwocLykEPX1X1oJrmUgfGj1aFWYR16es7oaq7Qe92tjUypcJ1dn757oB9ExZBDFOwQ60wYvQPBLggasRijCPifyU8QJAnduLsjiWCScA56fMYXDnL2eK6MeWeFPD45vzoVXwFv9QdYTMl+l5sUAuoDXmGm/u7GY57w+g3eFiWsy9S5gyuWsnGBk5V99MrlVu8BO6LRSoJyZ9zdFS3mtWtcYOkCQoDFVke/h810NFTUs19qumjwz74oGC6cvwbgKRv/vIKcjBhXXedUA6teNfyJm5FMaxCgmoULlrOBXwPXX98JhEtr9gFW4olA== 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=qhFrel5hVc+QCQ3Zf1JE5M1aC4spplciKDjRVfXbf+A=; b=oU24125hCPHeOKa1e8lDIl8nauyhWf+JpXcX5W/oB1MoBO9OsdlN8nfbHG3/rbJHgLKwiKWMOIKWCA8NO2KLXLt98ClMEbOlv+MUG6k8Q0CSkw/m7hKko6GCit106BE4iUAZ8V1T8zR+La+kpw1QWxd8gXymF8AIzYNqV26xZ973TH3la5ZUrs5O7nAyYVndo2MJ7+aG1nsC6GZZng6acxRu+4tqkDe0GjWpccUSgJyyrfrNMTy1AVBQaHxYSEbmp6dTS2jRjeVYgzSNsgk2pYbODAvufW3qOar9yNbNA9STI1P7IsVtSdv7GFwwoBVetrQ5oYPAnMTiQIVSA6wseA== 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=qhFrel5hVc+QCQ3Zf1JE5M1aC4spplciKDjRVfXbf+A=; b=BH0LacuBDzYK4KBANJICGu3UH7ZHYh5lWS2YlaRW+5dp1+RTBig53KQhhlLN14hjQ0Fm7UbwJml8Np+YcFbFtjOZiF3N93tYBH3Q4X5L+RZqzZmF06kdLuDCj1+deb3tyxz8lGrv/Y66hnjT4ZOKCYgoiZj6OOXTkdMv1VkCBzs= Received: from SGAP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::17) by SI2PR02MB5858.apcprd02.prod.outlook.com (2603:1096:4:1ed::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.18; Thu, 12 Sep 2024 06:40:28 +0000 Received: from HK2PEPF00006FAE.apcprd02.prod.outlook.com (2603:1096:4:b6:cafe::36) by SGAP274CA0005.outlook.office365.com (2603:1096:4:b6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26 via Frontend Transport; Thu, 12 Sep 2024 06:40:28 +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 HK2PEPF00006FAE.mail.protection.outlook.com (10.167.8.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 12 Sep 2024 06:40:27 +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; Thu, 12 Sep 2024 14:40:27 +0800 To: , Date: Thu, 12 Sep 2024 14:40:14 +0800 Message-ID: <1726123214-208356-3-git-send-email-liuderong@oppo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1726123214-208356-1-git-send-email-liuderong@oppo.com> References: <1726123214-208356-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: HK2PEPF00006FAE:EE_|SI2PR02MB5858:EE_ X-MS-Office365-Filtering-Correlation-Id: af84986f-21fe-4ac3-0124-08dcd2f5ca1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: SsHvoWnEbNRw5NDtsSPQfIUh79fBBDCqi76HRMZJCSmGV1RrsDqRgwxv7uFY35IBQOjxTv358pVSwNuuLLkYfE7gz9/w9jlyzWLZsXpBNPzwBv82E+G9PDmrFGQpOVjwXk6jyFx1DcAsPqWzJmWX7z/7FuyEUn8c2LhMtzZ2wgUyTYAu/arEm11DnsrP4tBUaROAOPOyejbJPlOU8eIxXEwQ86yhx3kztXHF6uhgcQ5t7jeqJnNYeCkY+ERMidEZraCkOQWHEZf0ej5ieJZlbDV/iL1CoGFE7HF1oTGUboZcO1lyz9oqSNsTvjhl9lMqL+aXalcz6xVc2AyhYubXz6KvpDOU0ob/mvCbhGc5shQaVXCIKt0FCVvpQSLLhpX+3LEASXs0bRvUGpp5pMuM+jqRhxjCISQoyL4wO9GNEByjsxeeiHJ8apr9Sh1SBSXg2DVHD7o+eKFW1GLUG4ndJ4lfiPmtnXGGA8uA1R0PcV1qPcbBGq1eKgZcKc9JrIX357PL3lFwUyLQtqf9lfdnsOLKlX0VXS+uYLi7u8kEO2wcKiMcg/cgKkRdKkvtt1Xj5/S7btU4DPlnjy41O2NnvU37oD/eiu7zsfOvu+cGs3wdA4+2chj4i3xtFRGx2PNRIrZ+VWYSewcN0v/3JGy+sqI5V+6aLPtbcpHzOhPKqFSHldttMa28wKqhwAlf1TjGxjOoxvOYrALjrkQ0P9+nzxHIPA/FKREI5ppPlNhBECYvBuzzCC5PCi8Z+5x1PtcNMF8S+4BVndm+rfxSMzNDJ0r1ihBPgKF5Kx16LQVW/3atlHekEYw+xNNJHuuSkoaNOw0Rf0EnM9Vh5bflR6ODsalWXCRW3W19CqzxbtTjVAZhX1YgkKCMecGLw9gyNBye3lxnJFgvQEcUeMF8mx/9b+fcNPkpLbgoAB+Xdqs3qy8c45w3KmH84f7bF0lZsGTqIB24R8rVA3oekdDj1bUCbqmidqNhV6iMVwDQKqZygP2b/cUVOrK10FMA6KRixZlYuVPrwZIshZ8BKYBSaUulgM+xMmhF0M8WajAbVImSnHLNB9d4QFOCCaQgj6cqKnfmmCcu+Ha41bVwI9i7DZEGHBOqYF5QvOrLzX3D3Vv+gIL5msf3KFVEC+M7dwtqxiL3uFByz+hLWGmD8++8fqqCCd8Xxo2paov08LpegQoQmt89hrxn2g/60JkWBae7fKnNI4VUcVP21GMOvryXxQDkCPBJBN5gTm6IKq83tZ3zIsJpxqw0/BzX9MMeysPtH5BcGvo8YP3UvWa1WK69s1NLZQ76t/RTno3T/9+JuY0kTs/Ami7/PIaMaogFpLTLnQw19JRJzvSdyPqIq85gfRvdLQB8zRXMHR7S+dUl70zUxIBuHA8NDaBd1hNnPEMvvUsxeO/Vcc3jTRan1qxo5lJnd7I6Acb7LfcKmxLCcm/erjMs71MVHFUJX/9ivicXDQkw 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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 06:40:27.7727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af84986f-21fe-4ac3-0124-08dcd2f5ca1a 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: HK2PEPF00006FAE.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR02MB5858 X-Headers-End: 1sodVN-0006s0-C6 Subject: [f2fs-dev] [PATCH v2 2/2] f2fs: introduce 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: liuderong--- 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 free segments, mtime should be the mean value of each valid segments, so introduce get_section_mtime to exclude free segments in a section. Signed-off-by: liuderong --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/gc.c | 15 ++------------- fs/f2fs/segment.c | 41 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 4dcdcdd..d6adf0f 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 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..03c6117 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -332,20 +332,14 @@ 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 = get_section_mtime(sbi, segno); 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 +479,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 +487,7 @@ 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 = get_section_mtime(sbi, segno); /* 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..e62e722 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5389,6 +5389,41 @@ unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi) return SEGS_PER_SEC(sbi); } +unsigned long long 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; + struct free_segmap_info *free_i = FREE_I(sbi); + unsigned int valid_seg_count = 0; + unsigned long long mtime = 0; + unsigned int i = 0; + + if (segno == NULL_SEGNO) + return 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 */ + spin_lock(&free_i->segmap_lock); + if (test_bit(start + i, free_i->free_segmap)) { + mtime += get_seg_entry(sbi, start + i)->mtime; + valid_seg_count++; + } + spin_unlock(&free_i->segmap_lock); + } + + if (valid_seg_count == 0) + return 0; + + return div_u64(mtime, valid_seg_count); +} + /* * Update min, max modified time for cost-benefit GC algorithm */ @@ -5402,13 +5437,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 = get_section_mtime(sbi, segno); if (sit_i->min_mtime > mtime) sit_i->min_mtime = mtime;