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+zXvwVkqaHLhrdX9TQvRxmdCtXfPBF2tVqpP++WdQps7bzkeO2TwLgSjE5qfAzzsAaA2Alpa5hofSM4EKEmAEdnoN5HitQFsag6QYrtOov/zmD1UCHPDDfJl6+WrB5gC/hg1SCCnmi/gAi9EOp+3DC1H6Di8kfawjf4Osv2Ng2Rrfkfp9WMe3ngUuQwnfTMHWMNWDaAJMNazWcPAIAchlHk3UWEL3bULkTElWnAguw4dbRQsfbNo2EawWZm/dU3NJF6jbEQdmu9uhuQ/e9U5XNB/dnnelbhgNUXhYI5AcaP27YCftIL9lOl6LiO3qpwTbxj/fI2R9vU6KQmaHxgBSU9kCxgc6UapJ1BhFwu8nzs1MiGbKFU1gEfimXamDqhx7mTnfOr6gS3pLyarRDzDgknuPu2Sl9X7EPgNPbx5S4Bm5UIJkQcJpvCcGHx3MYyj2qmLMf2j9Ftfhw6eVbCWD9p/pvnjISAl9a2b5rWalIClsX+P20CvrlVT1StQzB3WuSDKWrfHjEfX+Hl+w+iJJ+aqOBrZkiiZiP90gMpcUBPinqCiVb1hypLkAHfn0LIKiUn0Ct2td9SoBEwcnbZL8Htjvzdw73lLD4z0nYJIFoh6ZkdkXRECuCkfZSpM0sgiYIz283S8UO0zLi/C+2RBGr4+8tEtKNyWJVvn0GTXoXR3Nn9tGyNx9/kqyTgXmYxvdxR5HN8YcbWeyOKbDjKRyDmhprKHmDnVjcT9uta0ztOBebCK7A4fcR8J0wSJkLt2VGUbJx9HaBfv9ngarcbPYQgQdJxpqbl+yudDAnSU7BK0dPdnKAVBIZNNOUurMEE1ea9KFJb6bj20/N/0B3kczSu9M9M00uAane6tqDowS1xzyXaWW2uJuqM+Otq5pJ75aJZo7cZJmRMZ8pWLh4JygJ8e4cbsT628xWJq/xgnc1rhrN7OZTmjWY6ikjl8cr22WQfJRFnFGZwByQBrBVgwoQ4pLvwrQb5XlHvbunX73rmbIhDy1HWMxRIRsbu0yT5essaejyygc7IdbCKRLqV0Su17aOzY8bM/Pd5djoMg4voSX220ypmsQAX1UAFU6FW9J9a6WdS2/aowa//WwUF05kOPVirvtjYvlkGGVGiJYRGEVTX9THJuGxuFYo/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()); From patchwork Fri Oct 21 17:46:33 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: 6913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp826883wrr; Fri, 21 Oct 2022 10:47:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bCRiHCyT4tmxuPN1xI4QYzQNAIW8DpE1Zk2mQkFfhFx66/LeQ3xN596dKyzrCDdHSBeLF X-Received: by 2002:a63:b12:0:b0:44a:d193:6b16 with SMTP id 18-20020a630b12000000b0044ad1936b16mr17293808pgl.604.1666374471203; 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=vJidoHFhbh3nNEmwDSJMUtJplzBt0OaRa/XqJKrUiTHjzfvtSR6RmkvfvtzjLcTxKG QZTXJ65Svn8cB+OZMyfPRvS2WI604lH/kQY6442vVfzHGdUf+bGzTPHn6kgjBq/BL7C+ hQ5LktmjCVfiHafIG4zEDAwXQybhb6DhdfZok2UxtyIM4tLOoIxvFURjd3ykWol96DH9 qo/W3fhcju+GnQLWF+qbwitmL98RQN3XUhbk2k0+p7uQRW+vhtPQn5ndEn6qBiM0Cnd1 LkeQvh1XTptbYK3DsKlRxzea5JR9ctqi/x1uW7GSbrOhlQmy6fHJTwHgOZoVJ6QLJJ0x 6HNg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=szFsz5ab2NvukvLV4jgwWzggM+83qK0bSyJwHLhmyBE=; b=YtNv3ZPR1tYg0nz02Wd15grfEYCir7NZ9vukEX5tuauYzCnjb45u2YK095Nykl8p9r XuSksKO3jzs8jKsJgJ7G1Iv+v0yxkX1o53seyhSMCUnnzYQOFzdbJUjOTcdjCh7TNVRT UKWOYkBAfa/K7e1UkNhGGBaWVDuJbxb5Wm2GhmGPqCFusQ83DhPN6aa00BV2bGWX3+w0 u7cQHTLBGRMF0BghS6/Y4442Q0MsntO8umpHRTEtrRRx5RTRHtGUm0ajjx9C6xZboBCb nGr3LOY7w4JRp09HxpCB7FnMSIun2CTSSLlwSgxeT65L2nWS/4lXIIaYrN23e/dKtzSV 9yNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=pCPYCHPx; 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 e10-20020a630f0a000000b00434ffe3cc11si25841349pgl.870.2022.10.21.10.47.32; 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=pCPYCHPx; 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 S229965AbiJURq7 (ORCPT + 99 others); Fri, 21 Oct 2022 13:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiJURqx (ORCPT ); Fri, 21 Oct 2022 13:46:53 -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 E653422E0CE for ; Fri, 21 Oct 2022 10:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=et3PBZMKSnxExP8KKhom6OtERJf9tYFwuNBsFRVXMGaWA32wn0iJEj+uDb2XZF02IH1FP2MgI6C/gCjr83fMH5b6q+q3bq6bqLTmCZ4xw52Ak0xs4azq88nlrRn/R1o7xzODDqKKlE0qculaojLHp2qPIrkNTp+NhnQWTviRm17a9yHG2Pe6ARJf4Kq5StLl0YqTRD/vVoPqAqvU92hKO+SRTPjK0SVMAGyqFdL8/n0SDKHjFgh/c2Tn8TtseENtb2zYoQRInQ/p7StxrB2fmYYO8Wk+cJG6GbrMbIW08SRUZbLI0MXRUi9pdSpA2n8GSqWVelzjxx0e7yvnV7lClw== 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=szFsz5ab2NvukvLV4jgwWzggM+83qK0bSyJwHLhmyBE=; b=dRVSuw+eRNhftGTlXl1ZBObMnt6I8IYamZrxJyEd3CAzaQSIPYyM2JgtZOiAy8srHT8qLGMa/T3NVjqAqQNR3VQbHV8mzLZmKFeKdtgJHgC2vhiUX1iLIhHdf4VbbnRQobq3BV61v7O7+2Ju8VdnY5v/EcmTA+GLdk+hq9zhx2+e1lfW3ak52H1mnPFzgrttSito7Fz+yLlgM7sImoz7lq3/ZwS/KOG9mQvIW2RtVdOXM1LSDYaT/Pb2vGfrICCwzSOvj4wRBduC1rO7WbxyEhVy1QvqIRcXWD7lXqHEjlyo4cRILIlvzkzFKbuYgLiT3GPjzNmePbMdiFNQF85aGg== 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=szFsz5ab2NvukvLV4jgwWzggM+83qK0bSyJwHLhmyBE=; b=pCPYCHPxCToxLgNIf2f4MSLvsJatStXxEFBdw3OfDhfOCZhJcjdnf0ReQ3nLtPJ0GddPKNGsHKsV00pBZqxtqZmqzUihJp9ML//RGwLo7GjxWlbZH1IetXfHCe4dJUxpGAfVsCqHYGW2kGLkGV0gd0dkOuvvHKUz4QpQHlLmo+1czNTwR67ftAST/wekhdCIk+ouvKtYpRSdxkuLqOVJ1JWNmFUxHZH8h5tZwjK+PkQs39gM/SMkCY6kpd9rnrcQnvbUOQ3Z+Ia5kmgWi4ICb5wWFibjQZNRsh8srDLU1gUdWEaZj5yJdh2H+sb/5hRCwsfbpDA+lTUjsIgaNJFAsw== 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:48 +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:48 +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 2/2] f2fs: introducr gc_urgent_idle_remaining sysfs node and mark gc_urgent_high_remaining node deprecated Date: Sat, 22 Oct 2022 01:46:33 +0800 Message-Id: <20221021174633.12541-2-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221021174633.12541-1-frank.li@vivo.com> References: <20221021174633.12541-1-frank.li@vivo.com> 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: a5269bd7-3d11-4dbc-9ffe-08dab38c3a58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MSyWa1dopUFUvN87pQ7FaAFdvkjPzFNj6jlN6cBjWt2ZRtWAA3WOrmPwHZHiw5AzBDu5gGQv3Zfk9DrspyJlANyQwdrEO+RAWPTSKZXWMH5Ao+OS1q04OmnBEpgs+Mcyjk3I4ZbOUfFETNp8NFjSaccjmZzCD1W+JO5QzVrhj2fVnOV8Ce3vtVQeXbw/YpeeAMBYwXMsVXSryafUP9Mm0dtcW8g1wDu07zdXHLFZkUEHaRKAuGMLs2fmjyubnjZuDlmkLtAooeIjgBrSz7Qxp1tIkbPgn9ziSAV4gUc3qDrNBaWpXZcLldR0h0W9pRxy3EdsY5NDGoB9T73VkN28VP4VCaMNWKj9PEyZfDFkp9rhAnZgUVBndC6AjrzAmA0DI+bCW9kN+0/RsRv+YZKkEu0Ok1RT1xgheDWgj0jE+Di/EeOp3HAVl3hhWt7rL30JiK2zbgDYW2CYHzfdveOoI3pyuUnmZ0SvOaHiQfYjDiUhtnZ1uYkPeGKsX5nnMGemylo6r7qqqC5XhvYmopSFxh/66Ot3qmR1Pc0Aqb40tzwWqW7TzjC0Y/g8p/glayYwBZCaKpUeTcpw+9N2ffDVRXVu3o2gL+5EogS4+XECp14oYAstPwOkELy28Vx4fEQKGfQdSXBjd4tZKuIzQss9PQ937JktXFVJr2cSJMxCukXDrl/s+menWp+/c1gZ7qQ/qfz3DE6vCZL9CLrbppjT7PccBB5wVcAIT2TFg+QhDMYJVG2SNDjYeWgII1oJR1L+uGmRLaBFL54BQs4T64Qa1Q== 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)(19627235002)(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: IP9t/rsWlhhMxSxtZsh/JXeaTI0cXXHz8YZA9l9sAJfy0/+UEEujXXx+jtStWl+MKfY5/Qllr5olVBFqOrNgDjQrFU7oOEtxxIji0wlNdt/nZsaovgUwxs+fOofUZuHbujPH+ZrTNn4dRzgEg8ARIvhSEbsGrrjFeLiTnJTuh6ZKhFzUtTTKiUoh5YlTKdobgndeHZQjnzxY4rRV4YXSrbgl+qD3eDdmacn+Y4b7S9vubk1OI/1uE7Mv1xEsO7DgLOlgGXX4WNIXF918R+2FPBd3VGtTfb/82Oyt4gvkgW9/mFw5jK4wfmOUBz7ALVOR+Ye97uaPUXja1pB7FTyRk4k171koMZ784EA2sGJh9YGUCNpVzALOmzafn1LWlbBHWj3kFy181T/hY+B9jinweq2z0lT2F5nmRo+4gt8cdzXXa5uk14e9g0/0jXrMb838bohk06CCsTmruGQDmD8tQIPsoVgvbCNqtV+Hcy7lD7y4A+NzXpONgtsPDuNI+a05TXQQkegFXzhrvbYGW9Pm/NjE5G4mCrZvUbBWaAaTcnYdxgBK3LqnEMtASFDZa05LulF+kgXgaf1hOV1RED7wUuG+XF1XdQaR6XIqVQRXhc59CKakLISPjUPAO1Vu22FxnLPqNHkvJuunIQGXR3c+lRRFigy/PiR32WEq1Ty3cNYCL2wtXkep+e/DfA9u5vVOvtgh/kSoLcRCgvKHT/7jAVj0efSuW2pB1OHba5++qDTI/3rCaR7iHruqzPwzSb2qtXPrbxIydM8L8IjJagY6MbVcWi9ZK1Htn4LAR/aLPLiZb8zsDRdunz1XImTJUjf0+IKuGUEOFFsAcOi1Ak8CIp+EbfA+TmkqN2zE26JgemnzvybEmGAyCviYSEUgqeeXhH7rDvsE+NunCW0sTzvfmX3tEQKevbTmbjv92P2LwmM3+VWtWDmqYf321NuFg2H4mV+eFV8sCl9rgo1U+JT8yLcWTMl1eadiIelyngi//TWpSOtRLCsIA+zYXYNeM1XZj/5yBInhBnTuQelrrVWZTrUUss6YL/ze1ZSxD5y+/pBM8Tgggc1VWZiX7jGl5TEEfTxzok7SqIAtH3fjjM0xPFZoEcyIedGRoFEAxJd0s3/jIUQW9irCiyffvGOJyQ9ZBsHwc5apcosf6zcU8jamDqrDhCIwvc32Jb+rVfdLI7g/0Q6xNKdnTO/mgUbn6hD33q4MsGXGHHNyXuF/FFx8vcVGikhZ9QPS9c4KQecvq6o3kaNtahJ9bR9gHMueEH26UYh1IW9t0HVmgwMhH7+mXoUqk2nOThFK1TvaNN1yiBdbrIpV02ovr4yv5Q/Y2CzzgmPDzVHb/sTUxd4E8UGhwuVSozr4fVybuTL+NUTsGFRFu3SbzCduSENeOgnvtO4OBH5yqcxj7IgRXM93OSB9h3L4UPWYjGfJQa0mejxbNr0zPT155lwmEwZqVGvzsvnIYXMf1O21/tILtT9HW8AJ15WARtsl2jg19QCzGuuNOLX31ZojsJ2ujldYHcvgiWgu+mprPnW6Y9gf8fnZGTNOpbmc/gaHyNYUYp1elptNT8QGUT8yVQS8GVi92srZLDT3 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5269bd7-3d11-4dbc-9ffe-08dab38c3a58 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:48.3588 (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: ZK5zDp8ocLyIIeBQAkaW2dewQkF4Nz169W/WN/90kNnLVh7MjI/Z55jJs9fIZ/FWkFHCkInQ9NPceB0h886mQQ== 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?1747320277726012109?= X-GMAIL-MSGID: =?utf-8?q?1747320277726012109?= Added a new sysfs node called gc_urgent_idle_remaining. The user can set the trial count limit for GC urgent and idle mode with this value. If GC thread gets to the limit, the mode will turn back to GC normal mode finally. This method is not only applicable to gc_urgent_high, but applicable to all gc modes. Also mark gc_urgent_high_remaining as deprecated, so that the node can be removed in the future. Signed-off-by: Yangtao Li --- Documentation/ABI/testing/sysfs-fs-f2fs | 8 ++++++++ fs/f2fs/f2fs.h | 6 ++++-- fs/f2fs/gc.c | 12 ++++++------ fs/f2fs/super.c | 2 +- fs/f2fs/sysfs.c | 14 ++++++++++---- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 483639fb727b..859c4e53a846 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -598,6 +598,14 @@ Contact: "Daeho Jeong" Description: You can set the trial count limit for GC urgent high mode with this value. If GC thread gets to the limit, the mode will turn back to GC normal mode. By default, the value is zero, which means there is no limit like before. + + +What: /sys/fs/f2fs//gc_urgent_idle_remaining +Date: October 2022 +Contact: "Yangtao Li" +Description: You can set the trial count limit for GC urgent and idle mode with this value. + If GC thread gets to the limit, the mode will turn back to GC normal mode. + By default, the value is zero, which means there is no limit like before. What: /sys/fs/f2fs//max_roll_forward_node_blocks Date: January 2022 diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e6355a5683b7..2bad69cf9fd9 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1734,8 +1734,10 @@ struct f2fs_sb_info { unsigned int cur_victim_sec; /* current victim section num */ unsigned int gc_mode; /* current GC state */ unsigned int next_victim_seg[2]; /* next segment in victim section */ - spinlock_t gc_urgent_high_lock; - unsigned int gc_urgent_high_remaining; /* remaining trial count for GC_URGENT_HIGH */ + spinlock_t gc_urgent_idle_lock; + /* remaining trial count for GC_URGENT_* and GC_IDLE_* */ + unsigned int gc_urgent_idle_remaining; + unsigned int gc_urgent_high_remaining; /* deprecated */ /* for skip statistic */ unsigned long long skipped_gc_rwsem; /* FG_GC only */ diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 2f113fbcb85c..9641edc281b3 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -97,14 +97,14 @@ static int gc_thread_func(void *data) * invalidated soon after by user update or deletion. * So, I'd like to wait some time to collect dirty segments. */ - if (sbi->gc_mode == GC_URGENT_HIGH) { - spin_lock(&sbi->gc_urgent_high_lock); - if (sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_remaining--; - if (!sbi->gc_urgent_high_remaining) + if (sbi->gc_mode != GC_NORMAL) { + spin_lock(&sbi->gc_urgent_idle_lock); + if (sbi->gc_urgent_idle_remaining) { + sbi->gc_urgent_idle_remaining--; + if (!sbi->gc_urgent_idle_remaining) gc_normal_mode = true; } - spin_unlock(&sbi->gc_urgent_high_lock); + spin_unlock(&sbi->gc_urgent_idle_lock); } if (sbi->gc_mode == GC_URGENT_HIGH || diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 3834ead04620..f90a8c0a53ec 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3616,7 +3616,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi) sbi->seq_file_ra_mul = MIN_RA_MUL; sbi->max_fragment_chunk = DEF_FRAGMENT_SIZE; sbi->max_fragment_hole = DEF_FRAGMENT_SIZE; - spin_lock_init(&sbi->gc_urgent_high_lock); + spin_lock_init(&sbi->gc_urgent_idle_lock); atomic64_set(&sbi->current_atomic_write, 0); sbi->dir_level = DEF_DIR_LEVEL; diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index df27afd71ef4..2b1c653b37cf 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -531,10 +531,14 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return count; } - if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) { - spin_lock(&sbi->gc_urgent_high_lock); - sbi->gc_urgent_high_remaining = t; - spin_unlock(&sbi->gc_urgent_high_lock); + /* deprecated */ + if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) + return -EINVAL; + + if (!strcmp(a->attr.name, "gc_urgent_idle_remaining")) { + spin_lock(&sbi->gc_urgent_idle_lock); + sbi->gc_urgent_idle_remaining = t; + spin_unlock(&sbi->gc_urgent_idle_lock); return count; } @@ -826,6 +830,7 @@ F2FS_RW_ATTR(FAULT_INFO_TYPE, f2fs_fault_info, inject_type, inject_type); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, data_io_flag, data_io_flag); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent_high_remaining, gc_urgent_high_remaining); +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent_idle_remaining, gc_urgent_idle_remaining); F2FS_RW_ATTR(CPRC_INFO, ckpt_req_control, ckpt_thread_ioprio, ckpt_thread_ioprio); F2FS_GENERAL_RO_ATTR(dirty_segments); F2FS_GENERAL_RO_ATTR(free_segments); @@ -953,6 +958,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(data_io_flag), ATTR_LIST(node_io_flag), ATTR_LIST(gc_urgent_high_remaining), + ATTR_LIST(gc_urgent_idle_remaining), ATTR_LIST(ckpt_thread_ioprio), ATTR_LIST(dirty_segments), ATTR_LIST(free_segments),