From nobody Tue Apr 28 01:10:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A6B5C433EF for ; Wed, 8 Jun 2022 16:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245358AbiFHQV7 (ORCPT ); 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D { .victim_segno =3D NULL_SEGNO, - .should_migrate_blocks =3D false, .err_gc_skipped =3D false }; =20 wait_ms =3D gc_th->min_sleep_time; @@ -113,7 +112,10 @@ static int gc_thread_func(void *data) sbi->gc_mode =3D=3D GC_URGENT_MID) { wait_ms =3D gc_th->urgent_sleep_time; f2fs_down_write(&sbi->gc_lock); + gc_control.should_migrate_blocks =3D true; goto do_gc; + } else { + gc_control.should_migrate_blocks =3D false; } =20 if (foreground) { @@ -139,7 +141,9 @@ static int gc_thread_func(void *data) if (!foreground) stat_inc_bggc_count(sbi->stat_info); =20 - sync_mode =3D F2FS_OPTION(sbi).bggc_mode =3D=3D BGGC_MODE_SYNC; + sync_mode =3D F2FS_OPTION(sbi).bggc_mode =3D=3D BGGC_MODE_SYNC || + sbi->gc_mode =3D=3D GC_URGENT_HIGH || + sbi->gc_mode =3D=3D GC_URGENT_MID; =20 /* foreground GC was been triggered via f2fs_balance_fs() */ if (foreground) --=20 2.36.1.476.g0c4daa206d-goog