From patchwork Mon Dec 2 07:12:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongpeng Yang X-Patchwork-Id: 13890061 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 B66FCD10DA6 for ; Mon, 2 Dec 2024 07:15:04 +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 1tI0e5-00075i-A6; Mon, 02 Dec 2024 07:15:01 +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 1tI0e3-00074x-BJ for linux-f2fs-devel@lists.sourceforge.net; Mon, 02 Dec 2024 07:14:59 +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=qJ8j74xFhKJ5aFO8qW4k6RauWvZxd1TfmRmaQrCJXkY=; b=OfbVozzCNB1TZRKzqNa2J14buu ry1n4qk445nWJYUL1cYtpYMrJg+ZAiJkNSLFg4wmNxRMRXiVcaI2gB3ORw0KFqyI8XbxuaI7pTTNv wlKEeDHU1nmsfN29sEU7/vH98+fosnrczPGj7YbVaJSE20Yb6MN60Px+FF1tr8PHFUyo=; 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=qJ8j74xFhKJ5aFO8qW4k6RauWvZxd1TfmRmaQrCJXkY=; b=E GU9PKb6KFBks6aKtG/Bcg8Rxc+lHSPy8SRQkTLPmLlenkTTSCLwpnKO/1GzSGwvJhdzgsfSs+l7g+ 9fDJigt3VzIfUws8nOCWUhtZZNay/a5eozFyPb41jvIXeZe1B6hqtmL0wr7L+fjQWBFqal72CsdP/ hMX1benfCJhEs6HQ=; Received: from mail-koreacentralazon11013046.outbound.protection.outlook.com ([40.107.44.46] helo=SEYPR02CU001.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 1tI0e2-00058G-JP for linux-f2fs-devel@lists.sourceforge.net; Mon, 02 Dec 2024 07:14:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pNAmr2H4pi207/elJJMbk8Aoyi/x3YOpA5xaj5HzLQYUbc7QUm49mmpBpdq6QgL3yBU7HP4X0wxuqsnVkjQL4KAZCd7RSIqaPJ8lvYOlnCFEDuKEsGqFv5NDGSxBNw9Rqh+63zGqcS45vlsKUotdUCRU1EDuGz42ZRlpqHmnymjptKXMYh1ah+EPnwoyM5nJv0JxQRUsgmV2Wa6gD979PaSu3vHiDn3iqN4XMeYqhqrLBjISp6FEkMBPt7gcpTl7MYByOCisUUFAYujPQuK4HoR7bhNXHG/CezLFo71FMEb3nMLfkK+2bNfqDITs4BUVxFBZL4Ff/Bz4GqwLMttRSQ== 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=qJ8j74xFhKJ5aFO8qW4k6RauWvZxd1TfmRmaQrCJXkY=; b=U+tS9YVKzF5o+iOvyiRtvPSsMUScrA339TyecivHn3awmn367b4Uin0QwXtnHqaxSuObOxW0NntoodmEmVfGRr2hEpZn03WkMS1YZdXHpqBQ8SKfh3k/dfsfR55nr6w0gtKBPYJhtcxj0lKFy7ueu5p4L8vHVNCVXIMZ8UxpjQp/76h26XWyjL6OakCx5u+z2UYjsSmLhutprQ8pfps/pERIMG+yRAtJCpv6CbHQGqvrMHqJ8fnMhZ7XYi7vZ+bOOLNy/H4Q1rphE5i1bmMnvFSVm/ZfiBvbbd+8Go0Xf1hQJMTEyyQjpzP/zMBNZ5PgtD+6Bzhs2fFtQETIyBiFwg== 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=qJ8j74xFhKJ5aFO8qW4k6RauWvZxd1TfmRmaQrCJXkY=; b=leAk48J1sUV3jxzlGKTs+lA99CaE9ijh6UryyzsCnPLq2Mc1rSkvQ2MZRxy/r2113+TOY26DMrwA3U7XZ4FFlnFcfWp8olAJuI8Xza0hwUgVmTLhDjg5CDXbNuMxJnIcYf41fK5yACYWRMDV4Mj5VmiBrUW/rfAW53lvn1ilA/U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from PSAPR02MB4727.apcprd02.prod.outlook.com (2603:1096:301:90::7) by JH0PR02MB7069.apcprd02.prod.outlook.com (2603:1096:990:4e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Mon, 2 Dec 2024 07:14:44 +0000 Received: from PSAPR02MB4727.apcprd02.prod.outlook.com ([fe80::a138:e48f:965e:36f9]) by PSAPR02MB4727.apcprd02.prod.outlook.com ([fe80::a138:e48f:965e:36f9%4]) with mapi id 15.20.8207.017; Mon, 2 Dec 2024 07:14:44 +0000 To: Jaegeuk Kim , Chao Yu Date: Mon, 2 Dec 2024 15:12:59 +0800 Message-Id: <20241202071259.2643959-1-yangyongpeng1@oppo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR03CA0112.apcprd03.prod.outlook.com (2603:1096:4:91::16) To PSAPR02MB4727.apcprd02.prod.outlook.com (2603:1096:301:90::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR02MB4727:EE_|JH0PR02MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: ca44669a-1be0-4d4a-e805-08dd12a0feed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|1800799024|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 3EkiGgGcvWGTq41njC+zkDJnRMbeB+8sIsoy2h/0rX3i7b6ksiA54SIbJYJ12Yy9fg6OhKIW6oNljMf3lJ7bQnZe/2Z8NbBYPXx/nF3KOT6LgCx2BWsNPJscHr5EUniL/SWrzEbtsqs1xFvlQjoeEPsC2HcByZnJFjPcMDAMls2yMYQaYoVmNhzo3AndKaaNJC8BJkeLYx2aoU0gzxQRCc1rAp9uQ2neK+ZGjorHQB196SR0l9MNtGVc+4WuSiGYiBkNmdoj/kF2cZhPyfW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6+XsvwSkhwZZ5+M5eGMvklKJzYQqWHyC8/UGEbTfKsUKsrv3jawBiew== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PSAPR02MB4727.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(1800799024)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tL7qnF6YwFWqxV7Jv4aw8ORUdlyEuXUhFa7OEx0RaNHXXPiiABs29GgNUlyrIt9PqAmQc1JcpyMhygA20nFTocoBWA8stIthYJlIiAiK416sqPrUbV4GB/6bS6oDGbhlor2jQMg9gHMMiqgXp/6P7VUvwGkT8wdrns5jQ+zH1isfRNcNdoRV9l+OW2vszBRZUno6ktQZFQHKNRcCSOQXRbvPlv999F5YRzIH+IigOcRdQR8fESRq6aPMKYiFh8f+thN7rUXDG8UjEDUYEbvhb+PyayuI6nXZECe58qASTtdYTYj1cBLMSd/ZUhJ/kPFgwehz9YtOq0yD1+eEQsorVFSQc0+gZn0jahRj5bi321TlnA2spiys9Z8Uj+6SvUYRkOsS/0ShfhUrrI4XnEu70NGQOfiUZijAl+g5zzdxfptFXRSZdAGyudP+vrQ4gPFl3jkC/DhG+DOEwa4IV0EokfI5mM0z9jNHFDjl5HR1XtDm+n/9+Grnl1w7QrBh0G9qq3sh55SRJZDDpe2o/Z8AQW1PaqCKurCmWnvSWGd0EfZHvTvV7aRTtK+qyGwh3SA9xAVDwGuOdDj0vwyxha+D5stY9qco3taAcEVSrO6u737NNtnus+/a7wK5ZePk3Tqgevcrto+dzS+ltLtvMfVb2I0vj7bjMgHEDCTzO6/z43YqjJlXJwPPU3y4xj/0QHIxDMhJ9QOfYPOjlpHqcmfA/6c6aZPrAs5TybG++EPxHeA3EoDlWsOgSoOyEE3WFq0I7PSdlei/abPsos4O+cMHnrVNa1TNq+EIt3MAOL8xFrMYukubF7Zn2/u43bnO980C1rNdTMaB5JD02HrzVRQgXSOrC1kYgw8DidAQQ+GNFBUN/iJnnMWEnwmNHjz8WA5cAUU8mUtTRvRg/F26gbYhDGnp64VfTe04pFcxTVjw6dUrO1CF4VuRHSBjtFo1bvBsn2//5efY44Vu1SwxjkLUP3EZXSXyFskIV/y9Q+lvS9HvEMUbo+i4//G7mPZjEPrqfPYam6khS/u/Eefqc50l3q4s0KJteVG4BJh3eqHAxYjZYwISo4iYeP3xfCMHuVf89x12AWY0COG1A19YE6byp6dH0bPI9QK9cbtZWCEShZ5pU3wsk0T85uW/FviIRoq5Zmx5YlKAoJHPirAK+l+YaRDW8tvYLk9tUXLe+I7fGF8PHNUjDzXgGly5nKOlncNYRxNX5jofovX5V+eW/jMG8bXTwe9KMA1jN8oqOMDf9WnBd/hSVJkRqCasDoRzAOf9mt9W7VDB3jdo+g5T07sFf+rq+r3vnoMRG3jWS7Ii8b28pfdym1YKP7Yd3vd8SSiLXAOWgnl95tlSm7t0RffP1Vw6YauHri8KeHf2+tYk48nNIiFm3OuNIb8hX2/XMb87PLStK9ikL6Fz2bKNJ/wP5iTVtLDO4tyZPofAwZRxoHZQ69WL2bggEQuFzCsGHTSo8GbFLkjRVoY4xgtRhWfCCYUJUaYqzlJ+O/rBHI2ceia8KCviR8fDJ2crSc3h85UG1jyyjHlaeJTs5B9uMwsJIXB0D7L7te2J677TjoUeLp4MFTusKmVO3w3rWnKBUXK/FGvGtVmsojT5391dmwV2bg== X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca44669a-1be0-4d4a-e805-08dd12a0feed X-MS-Exchange-CrossTenant-AuthSource: PSAPR02MB4727.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2024 07:14:44.0525 (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: GYMSSrnK/eUDS4WXQMojsEuqnawS0oL4wJgRFb64szSyiGrWoZZFvpnaDdb9zMWq3m9IEeKsh12xRTAyTPyPtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR02MB7069 X-Headers-End: 1tI0e2-00058G-JP Subject: [f2fs-dev] [PATCH] f2fs: The GC triggered by ioctl also needs to mark the segno as victim 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: Yongpeng Yang via Linux-f2fs-devel From: Yongpeng Yang Reply-To: Yongpeng Yang Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net In SSR mode, the segment selected for allocation might be the same as the target segment of the GC triggered by ioctl, resulting in the GC moving the CURSEG_I(sbi, type)->segno. Fixes: e066b83c9b40 ("f2fs: add ioctl to flush data from faster device to cold area") Signed-off-by: Yongpeng Yang --- fs/f2fs/gc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 3e1b6d2ff3a7..8029369bb71d 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -806,11 +806,14 @@ int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result, goto out; } - if (sec_usage_check(sbi, GET_SEC_FROM_SEG(sbi, *result))) + if (sec_usage_check(sbi, GET_SEC_FROM_SEG(sbi, *result))) { ret = -EBUSY; - else - p.min_segno = *result; - goto out; + goto out; + } + if (gc_type == FG_GC) + clear_bit(GET_SEC_FROM_SEG(sbi, *result), dirty_i->victim_secmap); + p.min_segno = *result; + goto got_result; } ret = -ENODATA;