Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2681793iof; Wed, 8 Jun 2022 09:48:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0bl0UO4vHSukmLNju4DkJbmlDily8ezeIgZH5J94X/DG0gkdNcP1LXLDC8bvAXilx90EG X-Received: by 2002:a05:6a00:996:b0:50b:76b8:3bb1 with SMTP id u22-20020a056a00099600b0050b76b83bb1mr35797113pfg.9.1654706928350; Wed, 08 Jun 2022 09:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654706928; cv=none; d=google.com; s=arc-20160816; b=VNMMJB0/IanuRzplPc1TM1P88fhcb+ecKyCz4aupJfmTw8hUZB4f2eD4vXm3E/jbq4 8iY1jyyI44EkdhLtr9PzBS8vprIb7hkiThx7rSr0d6YFIObcOZACznIYdQjX9b1ZPszR KMC3uTpsRDqOtKUfNTSoePjCl7ZIwcsYGKcK6ZSo2m9pgALKAEmElDQKoU3ouiHbfZfc k0/w1N1essONcpnW14rtvvhdFN+CHD0DYS/vbKqE6bzD5TWsDWQ8QthltzIJ+Hs35HA2 pUzEFZoOpi9tFEY/AT0QpMExhaUBum1NNylfOPyMEu4NgawAH8C57fw8Pk2QTIe1V7ME 1KEg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Zb0fYAUKte88xBvCeE6u5dytZf8Gsx6ysBFnHEISTZc=; b=rwpj8zCZf+u84ttZPnNASdhf20TPJce1sD1YqTOdXI3dILtre+3mW4gg7Tn4clh+r+ rtqhgb8Am6Nm+4//h+ToABNvZuRC73fqeWMyzf8+Ywra6CGwuBAE4UWviWsJm2nhd5aZ fAQmiMB7faMzy7Jy5cFndPo1w6mDbb2KUQb9vqPFC/3IDl3o4roJKP/eWSsS+KrCdMFB puJTwVtw55EL160H+STRE7sxEVg6VG+NgHuJ2f9BnYtnqyrpu6J92jXjRwhvEsBeGZFo xp48O7Glb/5me9Yw3f4l2BZ7h1NOI8YzSUuGcqtYH6lbfJ5w0eayht5qMseA2SFqWSn/ K06Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qaqjghi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pv7-20020a17090b3c8700b001e2cba9625dsi1363361pjb.67.2022.06.08.09.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:48:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qaqjghi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD4C53FD97; Wed, 8 Jun 2022 09:22:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245411AbiFHQV7 (ORCPT + 99 others); Wed, 8 Jun 2022 12:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245383AbiFHQV5 (ORCPT ); Wed, 8 Jun 2022 12:21:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64EC142A3D for ; Wed, 8 Jun 2022 09:21:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 01288617D6 for ; Wed, 8 Jun 2022 16:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5339EC34116; Wed, 8 Jun 2022 16:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654705315; bh=lPh3hZRcFpvlW3S4ihSANExlRpTo4MEmTcXEXEF5gwg=; h=From:To:Cc:Subject:Date:From; b=qaqjghi4B/VtzJItUzaAtvw3g2ib6txROQ1HyZbBHUdQ4X7wopW76EcqqAQ/+esFM 1V+liOkpqk/ME5bRKCOlMzKAFatvwMQMVZt/qLeDH2QgBU75moxRQPUG3Y+wd1NUSk AyJEg5PHq+JhpQqN1lsAhF25F109Sie03MhI5kDuhfzB+nUrXJOvCLKpCZLGpY/0fS /411kPLTPYSI+jWW3P3vlXl0NwS6jjdUNinMEraCJhgo+SGtSb3v7nk/u9leKnSY62 /IPVbcHT2P6aJjvqt0xowque+pBzSeK8BWmUOScBBxPuv0DKEbfQR0z6YtI7i6vong 7iaMslN5M+oLQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim Subject: [PATCH] f2fs: run GCs synchronously given user requests Date: Wed, 8 Jun 2022 09:21:53 -0700 Message-Id: <20220608162153.2035396-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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