From patchwork Mon Jul 8 12:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 13726481 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 E9021C3271E for ; Mon, 8 Jul 2024 12:04:39 +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 1sQn6j-0006NV-OI; Mon, 08 Jul 2024 12:04:38 +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 1sQn6i-0006NJ-G4 for linux-f2fs-devel@lists.sourceforge.net; Mon, 08 Jul 2024 12:04:36 +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=hYIGXcSa0SjG3Y2pLis/l7KVZCGB7POrkhR8Rwldd24=; b=f6l0Krp7z85B5KLT1uz5yTMX+X 4xTRIERHiT5jY2AeqlnIVd0TuUOMHBydNT91Y8Nq/AG0+Tz1ZKcQnMYBtlthTwnqhrRimlVxN/bMk rFXtSfumnL+uD0oe0zURgWiG/KkIQiaDSDYmZxnJygS1VEn/NSRR4hWK8wz313VR/nGM=; 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=hYIGXcSa0SjG3Y2pLis/l7KVZCGB7POrkhR8Rwldd24=; b=b thHLSM+7Lm+K/6MhfF9Nt2sjgm474yeY7Y7si6UVj+BHPyKznTtopvFd17lkAlqQOOLK6WUMXuVKr 9pZri89GMqo3Avu64yYZ5kcJzgdtUG6NYl/Hohwq/bgfDaPycsIf959CVHoaSnTMSNhyTo55RyfAL QTrY1xWZ6Pmj4D0o=; Received: from mail-psaapc01on2057.outbound.protection.outlook.com ([40.107.255.57] 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 1sQn6i-0005O6-C8 for linux-f2fs-devel@lists.sourceforge.net; Mon, 08 Jul 2024 12:04:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+AvR3BkOxCWSOtRNBhsz3cXmJGMpV0BW+9dJOme/5DKP4ZUQQtvcThtsEhCxZSU/bAq6Ui5abM4HiNfMQ/vvcvAPfG1fkHANS4afwYSLIfjBVtJF1RT7aiQcw7cPEnFK0FpXzTU3qBV3TjEPnKBv3t76QgVfLPmfoKwT/hrKDskP0DPPZBQBkG3ZBxpYz3yaTwJVYjJkp8kmuGSm1LuZgPbtHVydYW7tSoutftL3BHCprrpryrDKDBP1PoclehHOdFF0nbNsV2ijfDpsxJ3K3VWvXnbp9v6DsHImCYt1G/QkON6CHVES39xvh7S6gSENtAa8mNuKRa5qkVk2FMOpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hYIGXcSa0SjG3Y2pLis/l7KVZCGB7POrkhR8Rwldd24=; b=I/JCVNnm5oWZoMpGnsZzwCOUXrUjDGzF2uUfLdW5astUBmlgMLprXlZHFoVYQTONpbu6QrXJSceS1Q80sw26YbyhaF9VhldBQYt/Eu0jeY39S7qFQ+bZFpVNqzcf0R6AoTZP5cmDi/P2O/qhJwGW8LLSq2bauGfHEacSzb5JkgksEQWCoum6tQWmd5v9ogDUG1biwd8+ymLWXNe2YxdBZcw7mev95Ov7aB5Ew6c2KJrwBVfSBn80bA029qRKwR09s9/0vmhEz8I+u1Ei659ePYIYaQvyK1ByflAIUgsiXof87KGIjIOGJ+Qx0veTrYX4AzpL8/7UeLxq37/UX+ALBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none 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=hYIGXcSa0SjG3Y2pLis/l7KVZCGB7POrkhR8Rwldd24=; b=LouQ1DA5d0UMXwtNnl8y/MxbKWZk7CHNtmqETFbOC/OBmIVRrPWPPFSDzfnBLilchoe/aYdmbGsYgd1MPj39eH0dgxFCeTkvDYpJ+ERMbYbe/P5a1o+by+lHBjied30L2QV0m3sRMAJ5ZFpjQT8mQ//IMFe4BaUUYdT48akusiY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) by TY0PR02MB5947.apcprd02.prod.outlook.com (2603:1096:400:205::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:04:27 +0000 Received: from SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796]) by SEYPR02MB6014.apcprd02.prod.outlook.com ([fe80::bb06:c283:a50:7796%7]) with mapi id 15.20.7741.033; Mon, 8 Jul 2024 12:04:26 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Mon, 8 Jul 2024 20:04:07 +0800 Message-Id: <20240708120407.2807639-1-shengyong@oppo.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: TY2PR01CA0020.jpnprd01.prod.outlook.com (2603:1096:404:a::32) To SEYPR02MB6014.apcprd02.prod.outlook.com (2603:1096:101:6b::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR02MB6014:EE_|TY0PR02MB5947:EE_ X-MS-Office365-Filtering-Correlation-Id: f4151172-422c-4419-ff10-08dc9f461cf5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 1qUJWFt8SESCWr+5Elo7MEo2dP6IF9CwzoK3BOObxkwOfy/tPVGJI5TaTmqT8c4yqdlMLXP39y4Oy4Ip3ZJhp4DQBwnY32/W8zDlDMqBG3T1T13b6JeedU2HzGgzifjMiCdf077neXB1Hlnd7AVw7jPhZG09T/1vrje9fAtmu3SuQ/2ZXcPb55ATOz48VxmJAaHZvrUKLsHqvaRontxg0bYnqrqx2DjFT69RroeVtR00CMC4tzlkQlj4e9vSc2Lc49frMWs7IsZck/SpzIA7CeTD7cqbBUJcAifdyx6iCI8R+8V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pflsDgLa7BNwOwcmNi1ICA4PcM2Uwd95KdnNHV7csIOQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEYPR02MB6014.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oYyuaPkDTFs+V8riRDrlZ2Jw0ypMWdozz7K9kBhWuoZAWBTYS1+HHVkhdDfJKXz4GtCErZy1JHSW62OXfU1dmpJIWc96oCyhuWFmjP0PPEGDd7BzZqspGu5Taife2Gt5XWbEi8XYdzGNaIYSo0UX+cACgTeYKw5EleiSmbKzMnDqWix5n1P4Jaf16YGFfZK4CpQkh1OfpUq1YC3Dr/u0awtbgro7UD1GHDmyz3PLwUa/SfqhUXhoA53cllsx7thQrEZ4r2pQYw8iTTtYn08APHcR+OyudJpVEMwnXNqqToB5SQdwyzzdybtm9wqgFRDO/6ZcrkCGH6jP+yKGiDJlsQT19UE4GFOt6UJOgTGdPb70YHg5y8diZT2QBqMsQZs3dZwS2mqaGErbXw/JYbLonIbxEn1LCQSzAKDQfVrwPUXYEyZEMy0gGj++WzGdr0LE0AN0mSmgA0ZbjRKJk7dWUwMGrex+QFOdLeNlPrBRWR+Z2evsBbupfBhjiHPZGATNORBS5/ljENz8Ul/KdcLUwDZbQ5Rth6beIJ2qbv5+8aJ5lYPibtmJi9Hdr1lONTGCoHqQXX4UP7q41Om14EU1yfIW2SwzPGFBSOSPguaSmBPaXsfykfchSIiNaTtKMgBK5KIPKeHppY6q4S9rSanDbb+F3c/Hc90UDgbvsgtLQTz8d+LqV8cOkVQ1rjx/Zce2GNskV1+qPb8J6g1ZtfDTCJ/hZaWR/quYHlVizIljbKa0AiNp5J2SDzO/gTMitcIUPt1HqzYs/zkLNgPO99h9wI44I09zGNi4c+DNX24663KVQITHbFPHo3FMNiT2+9SRafNCaB/DU57kuD4cv62SZ21dVMCHYyrfp4jdycQ9K3UVNoiE1IBsHD/Xzhw0yGZnUwbHPyax/rOA1Gx1n7axNkYtGzP012zUOIgk7oRI5H3DfdnAJe4ZccxlokGEPLj5KVxDDCteS8dEsjGvbocU5isOvI/nR1Pqy+p5u0DIlZILvUKUkzGVKuUyTnamtCorACKfWYtviBEGvaXugzs4hMOugVM9UlrMwrBSMWCW3TguiZOpus8UeB9hvb27zK/3wBXrblqBTFMHOI/xyapk3v4SKMgaXp030U1lBkR0ju+RVMwkZ5t0JmqKiX8hE5gD3aDADvyeTIR2KCbNq4R6wILeCOgXz/EJq9w0Im9bnt6u7FhfgQXKx+nbJLk7LbxRLE+qM/v9nocofsj0O8p0MD/LCy2GnRgd8L3C+zBUQm6BqbAiOa0Z9xmFNioKeRgcJsItlpD94pYSUqLL+8Eleb5sWygly1sZ0YyejAt09EkYB+ZTRPxh/Y3VF508w/ycDzPAThmvA8EkDle/uMNBCpir5X7fP+MPmUh9dx+qBgmW77KkJloWKRUfWiI3vo+UcXxQe/i/wZX4M7cQn0+vnbK48A9jR2YCiVPuCk2E0ozGyZIaa6uC7GAMANl+h22wfsy+GVoARhEGfbn+YK8RIljsEmtGUPXh9Tz9z3LnOniawtlCn04UBM6rPYjNaQ7wZwaUA0gvtrfRXncIImXWtX+mJ6RgchToXDMlX6IHD/e96oZuaXFV3O37Cd9Zpthq X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4151172-422c-4419-ff10-08dc9f461cf5 X-MS-Exchange-CrossTenant-AuthSource: SEYPR02MB6014.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:04:26.4062 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e5CluB/So/y3SvzP0fd39FbC748S4oKOYF40TdNz0TeDNCqVBSuED7jGaM/1mI3+wa7kcLJe/A5t3F9e7BdrcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR02MB5947 X-Headers-End: 1sQn6i-0005O6-C8 Subject: [f2fs-dev] [PATCH v2] f2fs: fix start segno of large section 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: Sheng Yong via Linux-f2fs-devel From: Sheng Yong Reply-To: Sheng Yong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net get_ckpt_valid_blocks() checks valid ckpt blocks in current section. It counts all vblocks from the first to the last segment in the large section. However, START_SEGNO() is used to get the first segno in an SIT block. This patch fixes that to get the correct start segno. Fixes: 61461fc921b7 ("f2fs: fix to avoid touching checkpointed data in get_victim()") Signed-off-by: Sheng Yong Reviewed-by: Chao Yu --- v2: use GET_SEC_FROM_SEG and GET_SEG_FROM_SEC to get start segno of section --- fs/f2fs/segment.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index e1c0f418aa11..bfc01a521cb9 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -347,7 +347,8 @@ static inline unsigned int get_ckpt_valid_blocks(struct f2fs_sb_info *sbi, unsigned int segno, bool use_section) { if (use_section && __is_large_section(sbi)) { - unsigned int start_segno = START_SEGNO(segno); + unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); + unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno); unsigned int blocks = 0; int i;