Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7959793rwi; Tue, 25 Oct 2022 00:04:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nIcp51oMooFdoIqna2jwMCXmiiXp4Uu6iSfrE8I7fZsigMEudPBvEOuEmkGLNEWJYNgZC X-Received: by 2002:a17:907:708:b0:77e:ff47:34b1 with SMTP id xb8-20020a170907070800b0077eff4734b1mr29735721ejb.493.1666681485229; Tue, 25 Oct 2022 00:04:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666681485; cv=pass; d=google.com; s=arc-20160816; b=OBOW5rhTy6YMEA3+UdvQ/EVIvY6v+9cWqoZTbOY8DEPVLSciG/orXHz7lJfSAd2IzC iPr15H3FHzk3/U9A9fukJESuJk4w7yVTCDv8XGqNFItLPewKPAOWx68ghai5qbfRfdXs CHiPXqOqbQ9Uxnh7KDDqjY7TGzdeMujANEMYgiTUqjt76c62iEOIQt7fr6iTPPwWNX1d 9FF9FIRasAciT4gJPUOXiED9oFGU0BKBVk9Xeq29Lmon6GLjI/hwI5kOXtY6hJcNSHl1 WJ2/6IJL6gxpMdvzAegSCG0N7WTI4oaBBxxepY6z0RJjNfVB+4WN3NoiJHWFUnXW4J0N 24DQ== 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=pysNbN8VkIYU1DHkLWkHGGdk2yU2bixq+963nWnPWhM=; b=fEF3rTN/SIqG0SzE3qxCpbh5q0TlKFUOIPDkfAqTeS03tBmynQTAO9q4PyAkQMbeDp F+jQmzNZfVpO7n8dW0g0G/udEBNShGhcnbdd8SMhs01DgsW/dcKKY/s5njVLyg98Ghx3 DxjQEb/SnQBRSgHHdjkzkoQv8dUL1gQZZllc0K3PJR6ZLF20bNsip4bfehT3v6ixQQpf BDUSG361RhD4Nr1WlJS7PnllySo3O9gJx+EnvnLKav3JCapnN8uQJIdwOWzW8c9VQT2o bubka9Tp+xs9+hphOt4c4Xh+ncAiO81nIWwPkZW2uFrMgSegCOBRrL4SGzQObJe3jee2 nFSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=G5fo14ZM; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a1709065d0f00b0073dcb2ec4d2si1990020ejt.889.2022.10.25.00.04.20; Tue, 25 Oct 2022 00:04:45 -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=G5fo14ZM; 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 S231355AbiJYGus (ORCPT + 99 others); Tue, 25 Oct 2022 02:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231263AbiJYGup (ORCPT ); Tue, 25 Oct 2022 02:50:45 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2117.outbound.protection.outlook.com [40.107.117.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C54EC3FD42 for ; Mon, 24 Oct 2022 23:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YiK2NTfpgctk3RV/hV3PQ2v8yYdhdJ98/QPmuzWKVMUX3yljjP+ryIL7dvZAPMOCXISscGL9Hz2VTHnhy8AAKIg3LUgA4TuZ0PXacx6EFqeh0PpEn6NHnBnSXQMM6mC4yUpZX0m6nITQ5MFgDFDDpJ8Gmpzv9k8ypm1WMwNZkGy+XFpFj5QwSxmMu9BtI7yjpaQ789w0WxuOHcUX38Fy3QuB9iMrSjyTAb+Hkwan6pn2vXn/s34PEMavhcIn1MjjaimTq08QLQKNZq0cwzGam4NY+3DmO92RYvWZomlnKyEkZq8DpnQzTy0kqawtnb52oBdjXnz9TiYEr/9t+515Gg== 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=pysNbN8VkIYU1DHkLWkHGGdk2yU2bixq+963nWnPWhM=; b=j2fbZMB95QxcTzoQPhp8ljmrcx04NVgXm2dCE2n+m9IS9pNqRCaGYaN9NjJjrkxdSgggovS/6yiUc5Mvesf/mhe1HYpbDwdEuIlnDWNWR1b1GfFazRTJGIy2zB1Y5M86dYkKYqIa4ru9Wye3GuB1BXMSBlIJRzK4T97rAiL51TyKVob2++DWZhVpsU8EiUbyurbXqx7royayEMfwiaYaGsu6OJMg8ERGc8fRkxn8o1tQK5TTbRvSCJDScwp7Z01QYJ552duP7MjHIeTWZy/syqm0p5TLF9N1Cnc5F5Ij+aBNTBUTzpj5KjYnYnewhqvCCWkDhwqpwhe1HuDZLYc0gw== 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=pysNbN8VkIYU1DHkLWkHGGdk2yU2bixq+963nWnPWhM=; b=G5fo14ZM9ZQt0h7gbCEY8VZ/Ej+xmofIJFqJIk+OBbgv234xul1CExDbCMzGTY/LJkrEyzZe2ysS6iAZLX/lrq2Upu2nQXJHHzms8BKW5N46uGDxMvWW0IxmwyCdSv2v2VQ70yepgBV0/E/nIDfcytuHruh75JcHqAyazTUEcIxS4vM8oobfuNiEJxa+Pt4CypMFb5/IZfdgKbEHK4N5eZtr9efacXQ0jkeY2/DCzm49LXu0ooNhao8ZZpARy+rvZiwyAErGOURiu6+DoajR8z8QaIPjY6y1NAfQ06/iZ0uAZ24n01XyJbcXLCaBrVFmoh5HYaAQTk4vH/Jna2PZow== 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 TYZPR06MB4144.apcprd06.prod.outlook.com (2603:1096:400:20::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Tue, 25 Oct 2022 06:50:39 +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.5746.023; Tue, 25 Oct 2022 06:50:38 +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 v2 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1 Date: Tue, 25 Oct 2022 14:50:24 +0800 Message-Id: <20221025065025.35017-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB4144:EE_ X-MS-Office365-Filtering-Correlation-Id: 23d3b9ec-fd59-4512-2f21-08dab65539e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +SBk8FG5R/a9qTKsWvuMehyFkRR2IF0HKhw74AXaX7ELh7kBEmMUQpO3CpaXC7A388KZmVQuJTrN7pBbXp6H1xzJ4vqwFAS2jiLtqmqLjvBCwvoxisXa99gOAYwTwAmResZXA/YM4r9x6yht/8ZjhnLmQrA3He5us37H9zEohWJdrhEfgLnw0aWowBQp+8t23El9J3zeslqCHfmIjEWjL3vyt0V6z3Z8yFK/YvDfoUU5pCfmZeCp1nk7QSoEj99Yz0eW49Bqr6kFCllW0m3NjynoHRLYZh6Fq/UM/VQSGxPAZfoeosEuqfL3/28fmKv4PkO/hVfn4Yxu79Ii9qmjKnUSqJbaadWosYEuw7CSuD6Wm27g/fYpMQ1o6rEVtNeoLt+WplHVIzWJK/kd2iXT/Sy3BmW4fSmDhc7Mm+IbnL2L1JhOUWPlXnTQ09P3yXWOCpCazc2UuVPzc+0C74OaJcyleM+HpBWKJoB58vEUrICN/hcCS7LIm87LbR9Eww395shGCZfeFwWRuPefbUjAxYLBHNINS6+KxGtImlxGq+O5bGDmBDGBZwrS6d18uZYtTcZvXD48iG8LAQVHc7Se3FQU0JAuJG9p5riRHiwMPtdEFZWpJg7cyTcKKKGDo9MO1t9b3XVAWrg8k4Y07yKVmYSc4TVseYYI6lK/lig1R/Pzf1ZZas2FYTpyylEdNvgf0CP2KmBNCjP+aGcW//0jstiy19O5lzljp1vRpBn5CE59etWjz1411tNIzMPIosQ1oB5jmznrSTbce/dVEn29dw== 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)(346002)(366004)(396003)(376002)(39860400002)(136003)(451199015)(83380400001)(186003)(1076003)(6512007)(2616005)(2906002)(26005)(38100700002)(5660300002)(36756003)(41300700001)(107886003)(6506007)(52116002)(6666004)(38350700002)(66556008)(316002)(8936002)(66476007)(4326008)(86362001)(8676002)(66946007)(478600001)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gQao9MpCOpmIC/yayS6K1nxvhQij/9GI7MRnsBcMy2B/Xa58YL+EP1WVOMKl?= =?us-ascii?Q?vxV3bb+xTIO3SpeYuHqszSmskenLwj2Nn46pOMb6dt5UcLnVVD0guRcAsyUR?= =?us-ascii?Q?dfspyNToB4n+PHNgXSUVeio7vNJXvkMp40Ul0wvfmuxFNIox3sBWTm9rgX88?= =?us-ascii?Q?v4fur1EhSDpE29Qaqxn0pvazQijRx8/Z8RhCKYm/vR/CkX7tcpIuoe1iGRC7?= =?us-ascii?Q?GvZIldo4VHnWGEeQX83dzccvyatxxInKPuCiOPEa2BS7jjZ4zypwNo3EWZCw?= =?us-ascii?Q?js0ccXc3ie1a+vkojkFwqYAvIBY6V53rtPAOccvwdHdzbi9erTrzGNx9M5zA?= =?us-ascii?Q?obcFre1M4WXG7knLg//kVOLGFyLX8wqLH8iBnoU4OrDPDIfXCwyMKGMTTeqT?= =?us-ascii?Q?6LMB6tSx+2PkX0aKoL7ikCq4XZ7q8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Cv?= =?us-ascii?Q?RO12Og3ysIAyi5nBeysN3xKifkycJYDDoT4dHX8jFUxS2uKPw9EehGin2JDB?= =?us-ascii?Q?6GJWeXxvKeGaL3hwFrmESJ/NxI3XK9iLRRX9bB4IIQEMpJ/bJJyFcluK28co?= =?us-ascii?Q?rJI9sklu2hMXq7nYMc/RQg7NifZGHOkf4DcNRtALcJ+0CzD6n+dnLG+z19mv?= =?us-ascii?Q?x3hnB4LuSYK1yItpPp6dcPFg+YLUjPIIiCigaz/EM4qDQN7GU4anFR/KRRdI?= =?us-ascii?Q?Fk5rVZDYtzac4WbzGb3q/wV2mVxdzxxZ5jDxSDgt?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23d3b9ec-fd59-4512-2f21-08dab65539e5 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 06:50:38.7861 (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: x9mhJ53lKDjb+N1zBJJlJkYXMWlT5TJLo1ifgfs7MQ56L/+Jj3rhSdkggihPMNdebXAuMkfAzdch3t29Use7pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB4144 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 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 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 4546e01b2ee0..e0ff99c7e3f2 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -96,16 +96,6 @@ 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) - sbi->gc_mode = GC_NORMAL; - } - spin_unlock(&sbi->gc_urgent_high_lock); - } - if (sbi->gc_mode == GC_URGENT_HIGH || sbi->gc_mode == GC_URGENT_MID) { wait_ms = gc_th->urgent_sleep_time; @@ -162,6 +152,15 @@ static int gc_thread_func(void *data) /* balancing f2fs's metadata periodically */ f2fs_balance_fs_bg(sbi, true); next: + 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) + sbi->gc_mode = GC_NORMAL; + } + spin_unlock(&sbi->gc_urgent_high_lock); + } sb_end_write(sbi->sb); } while (!kthread_should_stop()); -- 2.25.1