Message ID | 20221025065025.35017-1-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp846528wru; Mon, 24 Oct 2022 23:53:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vX1FGXayaKcCm8Wyx1+bTs++5JVEau0Q1bR/7t+TZ7tCJVn+MIrK/u3Z6sPIlLEQdHkve X-Received: by 2002:a17:907:2bf9:b0:7a4:bbce:dd98 with SMTP id gv57-20020a1709072bf900b007a4bbcedd98mr10814398ejc.669.1666680822901; Mon, 24 Oct 2022 23:53:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666680822; cv=pass; d=google.com; s=arc-20160816; b=STMEVbazCC6qsIbZo70t5k4JnDMx7DYYsAP/nJDw2zKGJSfvFJ85kX9tU1v9iaYkoO VLeIHx9fjdH7Gwhpyoro0PQ4zZXqYiKAmB4P7ZEs+1VSKmEzcMlsBH1FZZhg75/e242Z v/0l827YiPk+hKjI2SjBCyiaq6qCb1rZbCpiU8Pz8/Da9/MSPdcgrg3IrMEFWeTBD2cF B3pdLpjPKov0N+ildRBZV3cKGu7jJMl1ytXGA2XzGXasrNlvsVIlrxral3rXGfx5Ur4E fBK1V8UPpsmVbchrb2xYWXmx4EnMEcrCo+DHNu0EmoQ6Hz8v9JDrQpn/T+x4HX+BvXHc km8w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb31-20020a1709076d9f00b00780805b99ccsi2076905ejc.648.2022.10.24.23.53.19; Mon, 24 Oct 2022 23:53:42 -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 <rfc822;pwkd43@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li <frank.li@vivo.com> 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: gQao9MpCOpmIC/yayS6K1nxvhQij/9GI7MRnsBcMy2B/Xa58YL+EP1WVOMKlvxV3bb+xTIO3SpeYuHqszSmskenLwj2Nn46pOMb6dt5UcLnVVD0guRcAsyURdfspyNToB4n+PHNgXSUVeio7vNJXvkMp40Ul0wvfmuxFNIox3sBWTm9rgX88v4fur1EhSDpE29Qaqxn0pvazQijRx8/Z8RhCKYm/vR/CkX7tcpIuoe1iGRC7GvZIldo4VHnWGEeQX83dzccvyatxxInKPuCiOPEa2BS7jjZ4zypwNo3EWZCwjs0ccXc3ie1a+vkojkFwqYAvIBY6V53rtPAOccvwdHdzbi9erTrzGNx9M5zAobcFre1M4WXG7knLg//kVOLGFy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hMXq7nYMc/RQg7NifZGHOkf4DcNRtALcJ+0CzD6n+dnLG+z19mvx3hnB4LuSYK1yItpPp6dcPFg+YLUjPIIiCigaz/EM4qDQN7GU4anFR/KRRdIFk5rVZDYtzac4WbzGb3q/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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747641510785632422?= X-GMAIL-MSGID: =?utf-8?q?1747641510785632422?= |
Series |
[v2,1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1
|
|
Commit Message
李扬韬
Oct. 25, 2022, 6:50 a.m. UTC
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 <frank.li@vivo.com>
---
fs/f2fs/gc.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
Comments
On 2022/10/25 14:50, Yangtao Li wrote: > 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") > Unneeded empty line here, it's trivial though... > Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
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());