From patchwork Fri Oct 21 17:46:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 6914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp826889wrr; Fri, 21 Oct 2022 10:47:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LZIndcAow2aGIuxKCa2S9nR8qcR0KkXa/W5Qouz2YOcT9KsYFn1eYUkhNJW70qwQ+o8eZ X-Received: by 2002:a63:5341:0:b0:44d:69d6:7f30 with SMTP id t1-20020a635341000000b0044d69d67f30mr16960849pgl.306.1666374471818; Fri, 21 Oct 2022 10:47:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666374471; cv=pass; d=google.com; s=arc-20160816; b=ba7epGm4Qaes3FGiEsrfxrmeiODQpBxizcDgflqj+jrnXWg1/j0a9NjYDKS+QkpZu+ +Amcz2Ph710RGXb/b7cqlq381eRSlUHYNufh9bsi4lmw5LsyECDLdXEtfk2GfCotEoD+ Ysf+t8Jd9OatBJX2cwoAkx8ENUZZTJtg8O7VzWw6dKULrdM4MvVuySDWkWlOf7IWYC/t wBLpqqwLNkskAmwZRWa+swE00hg0uZSRPUgieBruPoERl8FPqzZJx8uhCFpq1wyzo5gQ l5o5U8elMUyK4w4jr+oLm3+966DyrWUDf64UPAUdaFhFYkogzS3DTZbxMTulLAX6ooGk Z7JA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=0Sr5YSZobnbclmXyQ21pXlgXZwokdjw9E2Pr4nbL7zA=; b=dZr68Hzk4sulDm9/4e0hi9J3PVZ7eNOT1GWh1lG0PTUqefyW7KbfUqaUgUym4Bx9WF 9PR30+EfLQhz9bpfufy8XiNzKPWTnFKO6qmySepvcs8R2fbdmABfUnKv8VTrI6aGW8eM ZxUmNkMgtAmVqyABYB2Bx3zzoRn6+GRe1SRF1GD6bV0KekkEL64EmGiTiJlM1pRAaq/y 3smcwr06uDCDJ16p/FBRPMqxasZGX1nkrT11nWU8O2Bc1iVSfLTi4HOHcTmaAFDiIqsm gnZQ2dxIrUl7yQigVLOkI0nsrxLI5hYVO3SjE4uh93HAZ5tqwUW4FLj/P403FvZma4K3 464g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=RSTdaD4G; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a634d41000000b0043a20d3388esi26252955pgl.321.2022.10.21.10.47.31; Fri, 21 Oct 2022 10:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=RSTdaD4G; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbiJURqz (ORCPT + 99 others); Fri, 21 Oct 2022 13:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiJURqu (ORCPT ); Fri, 21 Oct 2022 13:46:50 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2137.outbound.protection.outlook.com [40.107.117.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A7F24B335 for ; Fri, 21 Oct 2022 10:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dyb3YtaZe2w3KRqdbhMf/+Swt/SrE4ME57SLimDln5DLOp3+x2jcruw+2BeMGxmx2Py8/H/T3TLxE9635sGNt0NNPYqjovQ7IDa1ItIoCmzgj5HSOvWIY9/LSRLBdE1AZNLrGW2hrums1ashITd2MsoHiPXfl+GJI5mOmAJXkTi553tx0OCb/gcE9SMjWxu/uN0+XPrEu5po5JcxZKqpxMVFMvBn/hw9WIqZGHn7/RKYxgo+eaRGlaPc58XimD88wJ3HSgROmP5xxGfyg84rKqc44PhBujowy0IoCQlftYKoxOTPmumS3FTvFY2yK8DRQYIEwDmSIt5cN8jGRdxytA== 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=0Sr5YSZobnbclmXyQ21pXlgXZwokdjw9E2Pr4nbL7zA=; b=dVPzwOq1xLNiajznowAfrKMp4yaiIvsWXWFXxrfN0IuC27x6YT6r11sF2QVfPz2z62lUiyHlMU42vcSf+wNQ29mof6Yn7QziD2D0sP5q0HpCrPe9BHmVWwUore+8ZYgaJUZPbbaLG1RTAB50rRW8Hd4McR7HvfEUxex2I+8XPtKpVxS/CmSg9qkafZ7TdoJ/jlgVkJ53MPIKENx/6JGGvDYWXfI0RTowdmxW+Rl9DWG7mc1IJyNi73XhYl71dZT3uc3irDg+Jv+VAMVnQYB7DheWDm0mWmoeyvC2B0SLTA1wHyYBfr/3K9DFOftjhqalSx/jyS7Kn08cr1+vum9NhQ== 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=0Sr5YSZobnbclmXyQ21pXlgXZwokdjw9E2Pr4nbL7zA=; b=RSTdaD4GLW6NqyzrMmliSVUIsbYG15DBudd1TNzDRXija/7Sdiu62Tfn5ttneN8P2vpbSDQZvevScp4bhnarolaZNOh2MEHtep36QrnxXcM8/w7ozLOx1s8waN8uUuASG2KYMH3DCJywCKXzkVocNMe965erIGDXIjZRKV681drcs8DhOK2pAOEMlZDG1KTJxv877qUzmzc+7Zi1YSeuATrkn8qCBW6qVn6oNb6g2LV5W7/LD6+L+bYYW/MNfsGqMqGlqdp+PTqOnqBD8GFbc+kWYcOYKAcWEii9CfvRwwH3A/XwCXFH0dOZip96rnpPvpRaa+3w1EbSY/3n6awvCA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TY0PR06MB5056.apcprd06.prod.outlook.com (2603:1096:400:1bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34; Fri, 21 Oct 2022 17:46:46 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::c84b:5a6c:d66f:c0fd]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::c84b:5a6c:d66f:c0fd%3]) with mapi id 15.20.5723.034; Fri, 21 Oct 2022 17:46:46 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1 Date: Sat, 22 Oct 2022 01:46:32 +0800 Message-Id: <20221021174633.12541-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TY0PR06MB5056:EE_ X-MS-Office365-Filtering-Correlation-Id: affabdf7-83a7-445d-ac85-08dab38c391b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cs3FJy1CgQdNPLpotSYRBhNjRyXlyrUpzesYaLJUNLL3wki0btBdKPW3NIeCm6f0P2bVPacdt7hFQyA2r8GggZdDWca4BMpyEobpnhnXmRcKccbG8NYkk861ZlKL3YQd2broG2ftWr31RBPQDZLaRK90idhB/Ayn8knF9qpcCA/kuMOSxFdaOn0T+7Y9uHUBbwN3O5PODG2/eegLDK2Vxwf2HxMBy9V90X0L4Ju7EkPCFJp4hFiMKchH7Qnh2vMRLJf5yCHnBjNgJzbluDo8Li3twXMEj+zU5f8agIuVRdA+56ueoCl4TkFHN+a04QbxIhDAxL+LWnJk292gkmZwBjDFLyxAwSdtUCpYMEICNxbVafUojpIM35ZZhf79xj1oDC7qhX1DO0QiXDZQ+rtExvqSxlSMdgtF7WVnV3uq1vhHVbIXa85zqlsY3Lh4UVPbZhcaz/OZa2ihNT6B1OvlOQ1YXcLNkwu4PYUaeLyLhSGR1EgGFIKjPGZhIuEkWVtW+2A8onmutH+ff++cVnYBXNtK6RixkZj/kE0BfDdcK28wkZYp69/Sa3GuYF3mDcVJo0pgtXpx/PKyjmYAts6lBe8fYDTXIkuWYOO3eMY4KpJul8GCfpwd9KP13q9iuilGFd6kZEA7ZorSSyWzZ9fY1kE4XLKvHoflTilhCoeNt6WuStW70CJRJUK+9sCeay1B40TVcX1Ip4IfnGkcYTOwn+GSRibalFPuRRTXQpRZeOa4oWfZgyTjLTzPWzVr/XJH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(39860400002)(366004)(376002)(396003)(451199015)(36756003)(316002)(38100700002)(38350700002)(6666004)(86362001)(2906002)(107886003)(66946007)(478600001)(4326008)(8676002)(66476007)(5660300002)(8936002)(66556008)(6486002)(83380400001)(26005)(6512007)(41300700001)(6506007)(52116002)(1076003)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ut3rYhLwa1uA/bzSjeMxoI/tVEEGU5aSXYcUE5GCAFlxUAaZ0lYs6evn/3Kc/dCanKctofS8IidboVKUsD+k4+vhnRlOth7Gra5IFbA3WF3cTYd1PAtEALCQsqG6D1z8M9PEJcKLUHEpHoJYytJz06bmH77RQFyDjmTh+kB0kQ/+rr8pEbcyK3DcYuAxT3C3GUu1tWXQjX8CW+WVmvby928Ku1XUe5FenLhGCuhb1/q4gU6UTr3UOkEr40IyfPmH0M1ALxKfNJ+ZOm7tB8i4PKzRjhL7Ps0Oy5jYBOiI7GIYAFjJFYD/LrKBW2yZiQYEWyHHejiDuSsKQkxZApLQtVzxju9Y7zbFe7wuyCcHnLvpo3JU1/N1d+Exg8G7zgjPWEtFkGdjXQwBkXa7zgIWvJ+iWE9VGi341l3gZIaTbu40IvZd6+zXvwVkqaHLhrdX9TQvRxmdCtXfPBF2t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wUF05kOPVirvtjYvlkGGVGiJYRGEVTX9THJuGxuFYo/UUu4ZeTDO1AATQw0ZQ35 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: affabdf7-83a7-445d-ac85-08dab38c391b X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 17:46:46.2973 (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: 4a3kpdKcHQA8OF1T66TKZY6Laq1pwte0/0r3ZXCPpPeyTy25RroOz07BrNOfoMYDE2G5VCzy8I8cEe2lw9bqwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5056 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747320278455016389?= X-GMAIL-MSGID: =?utf-8?q?1747320278455016389?= Under the current logic, when gc_urgent_high_remaining is set to 1, the mode will be switched to normal at the beginning, instead of running in gc_urgent mode. Let's switch the gc mode back to normal when the gc ends. Fixes: 265576181b4a ("f2fs: remove gc_urgent_high_limited for cleanup") Signed-off-by: Yangtao Li --- fs/f2fs/gc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 4546e01b2ee0..2f113fbcb85c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -45,6 +45,7 @@ static int gc_thread_func(void *data) set_freezable(); do { bool sync_mode, foreground = false; + bool gc_normal_mode = false; wait_event_interruptible_timeout(*wq, kthread_should_stop() || freezing(current) || @@ -101,7 +102,7 @@ static int gc_thread_func(void *data) if (sbi->gc_urgent_high_remaining) { sbi->gc_urgent_high_remaining--; if (!sbi->gc_urgent_high_remaining) - sbi->gc_mode = GC_NORMAL; + gc_normal_mode = true; } spin_unlock(&sbi->gc_urgent_high_lock); } @@ -162,6 +163,10 @@ static int gc_thread_func(void *data) /* balancing f2fs's metadata periodically */ f2fs_balance_fs_bg(sbi, true); next: + if (gc_normal_mode) { + sbi->gc_mode = GC_NORMAL; + gc_normal_mode = false; + } sb_end_write(sbi->sb); } while (!kthread_should_stop());