Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp857254iog; Fri, 17 Jun 2022 15:40:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1si2iFGqvlZSj+ZgSaJO5yoCM8p6oJmn1DKf/mSQqw5BtMMzVhj+doPNTq3qco7KuTck8cO X-Received: by 2002:a17:906:7394:b0:712:3c15:ba52 with SMTP id f20-20020a170906739400b007123c15ba52mr10956161ejl.169.1655505619692; Fri, 17 Jun 2022 15:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655505619; cv=none; d=google.com; s=arc-20160816; b=MCKrCMkeOEyL3TIai48o5cRo0/zzXxoLhTTw/eggJ499qlM4z7JvaHN1C5Fe0kJvKl 9+GHhI/fBaNQpV2wnZm9BDy++iLiOUh8sq1FTr/RrYR7Yu93PrYaDHrc+eUGqAHeoUZp silT/yuTfEZ7m3xqoEAt8b191TohaaqjhLgykEic19Uawx/su+sEL2Gj06wIbBrOQX0G Sl9t+UasRH5ZjWofJ8zPLeIXfFAx6k26xWU5liTR0r1U4C6ne3DWhUxEwaQ6QWzKxC0i KgwxXq63bIzvzkHkrpKvpbzz7DE3LnDDMfCWsXcaD3rlsJZJoXVntBXpJfD2AEhvWCLS NUrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zb0fYAUKte88xBvCeE6u5dytZf8Gsx6ysBFnHEISTZc=; b=GHjxNpP6rkDyrtpry2/U5jN9dwkjxvXxebU0l2VeysdBjlqL+1DSWa7laxWoUBk807 8MD0mt9bN8mcJbGeKRKno5d1NRe1+j5WMmSR1QB+kJAViV2xLt1GFYuSNHAv+CANiNcG Th4PfKOBd+75oUp18WxeGDco5VC8w5y+288qiRWBiBEa5qaqPM+lhcc54q4MtgKpHjB6 5iSbvBmKx0PKxllZV4C1GCy7HeHD9ws43egYO1ifTKLEJS7K9lYXKF9q9YFl0aBzeJyF xoShigXzPgtufeo083CiKwcRMkrbpgQUPE/943CarUQGvlv9eyAw8xsg/I99wFulXO6A kvsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P9SQK8kX; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf34-20020a1709077f2200b00710e677138dsi3124658ejc.981.2022.06.17.15.39.54; Fri, 17 Jun 2022 15:40:19 -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=@kernel.org header.s=k20201202 header.b=P9SQK8kX; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346556AbiFQWbe (ORCPT + 99 others); Fri, 17 Jun 2022 18:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236719AbiFQWba (ORCPT ); Fri, 17 Jun 2022 18:31:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B145A62128 for ; Fri, 17 Jun 2022 15:31:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70051B82B1E for ; Fri, 17 Jun 2022 22:31:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29A54C3411B; Fri, 17 Jun 2022 22:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655505087; bh=lPh3hZRcFpvlW3S4ihSANExlRpTo4MEmTcXEXEF5gwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9SQK8kXbd1PD4oOEk/AkRKMAfUWzR9HGV3sD3jPI1GK4omVa/RgZ3pEsHAD1g0T+ c3157Dyg/rcK7+WYL4gqwsRTD3wRUVfkyBCclstkE6OjElKS6Y9y2au9auZ0F7kWyU RXUWvazndA/MhcXPFIZYZPbKXt1DRpPw9nQOLCkqzmlLfZFjjNxFv7Q1RA2AKz/jCa CllrJeFWYF29JdvU4HU/Wt4WF+cr6hg6OX+0OXdtDPQj/S7NyaleO/AKg7D2MO1fpF QsBTxgmh2r3JsPd5ZKE/bPnU2EGC/bme3m+/6XqnOrrPdYW2P8tQaFYP0mW6twoKT2 pyy9xT4okgeNg== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 2/3] f2fs: run GCs synchronously given user requests Date: Fri, 17 Jun 2022 15:31:05 -0700 Message-Id: <20220617223106.3517374-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220617223106.3517374-1-jaegeuk@kernel.org> References: <20220617223106.3517374-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 When users set GC_URGENT or GC_MID, they expected to do GCs right away. But, there's a condition to bypass it. Let's indicate we need to do now in the thread. Signed-off-by: Jaegeuk Kim --- fs/f2fs/gc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index d5fb426e0747..f4aa3c88118b 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -37,7 +37,6 @@ static int gc_thread_func(void *data) unsigned int wait_ms; struct f2fs_gc_control gc_control = { .victim_segno = NULL_SEGNO, - .should_migrate_blocks = false, .err_gc_skipped = false }; wait_ms = gc_th->min_sleep_time; @@ -113,7 +112,10 @@ static int gc_thread_func(void *data) sbi->gc_mode == GC_URGENT_MID) { wait_ms = gc_th->urgent_sleep_time; f2fs_down_write(&sbi->gc_lock); + gc_control.should_migrate_blocks = true; goto do_gc; + } else { + gc_control.should_migrate_blocks = false; } if (foreground) { @@ -139,7 +141,9 @@ static int gc_thread_func(void *data) if (!foreground) stat_inc_bggc_count(sbi->stat_info); - sync_mode = F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC; + sync_mode = F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC || + sbi->gc_mode == GC_URGENT_HIGH || + sbi->gc_mode == GC_URGENT_MID; /* foreground GC was been triggered via f2fs_balance_fs() */ if (foreground) -- 2.36.1.476.g0c4daa206d-goog