Message ID | 20241203065108.2763436-1-guochunhai@vivo.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-f2fs-devel-bounces@lists.sourceforge.net> 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 C46A5E6C616 for <linux-f2fs-devel@archiver.kernel.org>; Tue, 3 Dec 2024 08:09:52 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from <linux-f2fs-devel-bounces@lists.sourceforge.net>) id 1tINyg-0006oT-I0; Tue, 03 Dec 2024 08:09:51 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from <guochunhai@vivo.com>) id 1tINye-0006nw-Cb for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Dec 2024 08:09:49 +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=N9Ni5AHT7Qj1XSGX6KHCBR9pGyvC7E8sQuUmptqfnyQ=; b=HROb7IMN18a+K33WkujlrmUHF0 xR9Zi7RMyR4LjPH5R+zxEgfbvazxUYYjALVpm3xDZMNUhdrSCU+38uOYyNMO4o/xIp+xOZUzKeqW/ Ma4SKC9Tx5eMryi0f2e2Tx6YM81qhcFNUT0uIidE1WEKmwxnJ1yZVn5I99h05a5UKa+A=; 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=N9Ni5AHT7Qj1XSGX6KHCBR9pGyvC7E8sQuUmptqfnyQ=; b=D w9t0DZ/VzNiD1sbUIUnYkAmN+3iOUG4TKi43M8ZHJoKqdxaEeV9h91OQQmzHzOXLMbii3we0radBL +a2Fln2gyPDZuGfuwYGndsFN5T4lwt6HC5pw9e4JvJzSV1TNYzOpuCr82plwRSHcrwaqX93TN4DAg G68DuIA284EEjHME=; Received: from mail-psaapc01on2080.outbound.protection.outlook.com ([40.107.255.80] 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 1tINye-0000fF-52 for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Dec 2024 08:09:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iXUAFY4os88a9VFeIb1WRBSCNDq98qt/Ei/hH5jVIP2T5OPMup6wp/8pKM7LftcMqSj/VA1vZURs38qy0UVP8z9HExkVaL2RL9FDG4vqsmzamXfZ9BradeYPP+nFJRaNJBf0RSx3IvtuFVJ7srUHoPpIiLcah9wOVGIesuKHIW0twSbvBWxp96rwH20Nrw8zY0vfVBW2cHki6oaXfKAJFTBvj9vrVIKV1DMmCVJMzsaKd/1P6yJAgZs1reLXk6kuaH9qHnyNWTi9RN1ckvWm5TEvzP32JpAnRasmj+EaBap7XB4CNDhWaU4aMH9wZfalQ71tivGRXxJpt3DsFrYvyw== 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=N9Ni5AHT7Qj1XSGX6KHCBR9pGyvC7E8sQuUmptqfnyQ=; b=smZOe5sEE/RzchbIHjsAXU+YNDGwqmw+jKS/imcPD2zsDJyz4bN4wTDBNJDVF2wLyxL6jPnc8MOf4BiVUSe0wh0xqY4KSp0QRLxlkhpULMsNPoQRe5i8+Seqd/ctXAUu3mYvYQvweCHD+33VbSil3tfCc/9L+1E9aRAsHO5hvlde0at3J6MZawrQVYP2COrDVXY/swjm7bkhJ/9BynwcO/51LkScl5gm7lGAUZkh42awbGeJyPsEBBZBPfV9bOV+oMei1KijKFHpE1aqJTiRm7Ss4VJ1IOz/McpBDfrfvAT7RLG6Fj0xjd7go8e+St2zAUyjH3bGLvHtSojUWOn/sw== 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=N9Ni5AHT7Qj1XSGX6KHCBR9pGyvC7E8sQuUmptqfnyQ=; b=ZNUiqIjER0yMbZ896mUBLBW88cJU7Jo8KGBYE3FPntYqERQc8/FEMtp8FjnlLhdsBzuTFQTrBp4Wm7enKLyiYY4trE/hmpWhdEWbCbHiYoAm4rNPfgI4jojU4W6iH6+NQY0LzwN4DPUt92YFaKK31mOKZPpdDPbiLJCF93WMxON6u4uuvQy148jjdY6J1dIyFqFyM4IbP7yFYFkXNV+mc/eSQp3nQhdieG8/PD249klvd893EcFDR29TB2oigiRMAiCJdwesXXSrbV1qptALudtesEbNodMaVlVlAGTxL+BS4O6A2CMBJR4kU72Zu6GucQvdgeK/G7+DBXsruqFrXw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB7096.apcprd06.prod.outlook.com (2603:1096:405:b5::13) by JH0PR06MB7055.apcprd06.prod.outlook.com (2603:1096:990:6e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.9; Tue, 3 Dec 2024 06:35:39 +0000 Received: from TYZPR06MB7096.apcprd06.prod.outlook.com ([fe80::6c3a:9f76:c4a5:c2b]) by TYZPR06MB7096.apcprd06.prod.outlook.com ([fe80::6c3a:9f76:c4a5:c2b%6]) with mapi id 15.20.8230.000; Tue, 3 Dec 2024 06:35:37 +0000 To: chao@kernel.org, jaegeuk@kernel.org Date: Mon, 2 Dec 2024 23:51:08 -0700 Message-Id: <20241203065108.2763436-1-guochunhai@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0002.apcprd02.prod.outlook.com (2603:1096:4:1f7::16) To TYZPR06MB7096.apcprd06.prod.outlook.com (2603:1096:405:b5::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB7096:EE_|JH0PR06MB7055:EE_ X-MS-Office365-Filtering-Correlation-Id: 02420db3-c2ec-464d-5de7-08dd1364b2a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: bQPBU/04mHb1Shs3H6xlWln/F/v3Al2iPFbpBo92K8yB1WZtBEW2wM6ZEeONndi/dkKbF6CCtTB6RO0pKr60fgTd/2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Wstbgo8gPm9e397KhjgMhXkJsc6lUhqOLuyrY6gYEvHRlWxBVaXkcU4zNq6QOmGxYX8vLpowgwWxvHNE5Ho4zJDltdfF2ef/EbjCY20W5VOWqFULluMkZIDK1gtZggyze+kX7XaDlWfjLIt3LItiUYqocmb/R/rJLqGD3gNv24SNy9fgCkIQVsVEo12ulZ0Pm9ek2fakwm0Nf7gge1n1F9owH9JpbP+M0YzYDe4cObFWb/tAeuGeFzD1nVRg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB7096.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VAem7W1f+5Ku9xiBEQV8gMRnnLw16SOHyNghKz8BZaRF01BLjQ3pow9bkRpLhwih8gp8CnZIoEWcU17Ew/aIE1MxxU2+lbJ6Z/JoGrF2cNxThyiB/0pxG/v8g49cRkQ8vxUWqO8SUlGFqJYf0PItrOxY3sIHqsWQmpN0CtLebd8yE3Ic1T8//WqO5cvw0NxRJK6c2Y3N1Mgli1BVLMGnk6p3PNueeODCRh/ihEAtym/beJC8SG2Zmcp4Tw9LFVAfpdt1ommmwBTSr66w7hbKVJSM96+kpzn5HlSEaouDeWnxJQvNqmRkLwHAnmuCvJa+Ywi3/1/gDAvI+AjWAf7g5wQ0C9wOdWh+gHRtyGg1noxdts6lGu31J9+SFYLllqJU/T+rjzQpJNt3hkc6iAET/HNgiATIsFvpBn6tJ8VAcPx0MNvKJw/UL6L8+XapmZYlv5qJg4lxPA34pOmZsLiL6duRrSdye2ss2HM+oU4hyOguMvZ0/5neLqAvsQEf7SJVM8sib0I1FPwwovf1x4Uik46tA8uRSa/qmQ5mnFO2St7cdVi3wkHRO06c8jSJRMcy1Ebx5IlIKU750EDxzbF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MS-Exchange-CrossTenant-AuthSource: TYZPR06MB7096.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 06:35:37.2566 (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: W63zNyrLftVd0zMtG/vKiCaBd9jO6ogb2zb+OD/5mQpuTK2f2O0IqcDVjixkaGTQUiIciVNzXSv6q+xfhzQ+4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB7055 X-Headers-End: 1tINye-0000fF-52 Subject: [f2fs-dev] [PATCH] f2fs: fix missing discard for active segments X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-f2fs-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/linux-f2fs-devel>, <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=linux-f2fs-devel> List-Post: <mailto:linux-f2fs-devel@lists.sourceforge.net> List-Help: <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel>, <mailto:linux-f2fs-devel-request@lists.sourceforge.net?subject=subscribe> From: Chunhai Guo via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net> Reply-To: Chunhai Guo <guochunhai@vivo.com> Cc: Chunhai Guo <guochunhai@vivo.com>, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net |
Series |
[f2fs-dev] f2fs: fix missing discard for active segments
|
expand
|
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index eade36c5ef13..4fb1dc4aab97 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2090,7 +2090,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc, return false; if (!force) { - if (!f2fs_realtime_discard_enable(sbi) || !se->valid_blocks || + if (!f2fs_realtime_discard_enable(sbi) || + (!se->valid_blocks && + !IS_CURSEG(sbi, cpc->trim_start)) || SM_I(sbi)->dcc_info->nr_discards >= SM_I(sbi)->dcc_info->max_discards) return false;
locate_dirty_segment() does not set any current active segment as a prefree segment. Thus, the issue described below may occur: Step 1: During a checkpoint, add_discard_addrs() does not handle the current active 'segment X' with 0 valid blocks (and non-zero discard blocks). As a result, no struct discard_cmd is created for 'segment X' and the value of sbi->discard_blks cannot be reduced to 0 after the checkpoint. Step 2: f2fs is umounted without setting CP_TRIMMED_FLAG, as sbi->discard_blks is non-zero. Since add_discard_addrs() can handle active segments with non-zero valid blocks, it is reasonable to fix this issue by also handling active segments with 0 valid blocks in add_discard_addrs(). Signed-off-by: Chunhai Guo <guochunhai@vivo.com> --- fs/f2fs/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)