Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1012782iob; Fri, 13 May 2022 19:36:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUR7tQE68ajudffj+z/1GoNsWNU5aKrzLcJ/PGgyQUM0r9EGQEn7VVyKE7/p8wCO1jD1ED X-Received: by 2002:a05:600c:1c0e:b0:394:66af:ef0c with SMTP id j14-20020a05600c1c0e00b0039466afef0cmr6981962wms.85.1652495785201; Fri, 13 May 2022 19:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652495785; cv=none; d=google.com; s=arc-20160816; b=ER+7W86aD1x1oU4wwULU/Uz5eJGYydPWBsKyDGf1nI61Ki2+4TJdISBIueFw8JEdHh LPkw6PhD+Y+mcW9AluNrdwcdEGJ1+4jWHA+R6UrJwx2tJWo2E4Lg5qZ5isMQ24oUD0dO uCi5TEKSxt80/0NT9naDPBgcEz8xeOBVtvXVALProMZgs3x7y3L15ZIXZ/acL2yRWNP5 G3vueJyEP6qiZOOhA2i3XOmJGnnIk5NcH51VX/KPMSnRZavqSNWqaJaBFMR/wFSGdL6w 1Seqa15TQcFe+CZtetu4xC2uTFHPlpzQEIBteQRmpnNjRXqZSV9Wxl6QqX8UjbhRLO8k 911Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MvaPs9PPRCso8Cyng3QtD4BXa4xGVjaWFJf9Wff7L5M=; b=aUpaew/0N17dc5ITNkyoW2026cKu86nzpZ7/Gev2+e7D4Q4gjkBuzMhx4vtWDKJAXI OK0MuyEeXpaEbvwTaQ+HK5q17F/RIhc+ohboSxCv2BOg64ez9IhvG6g5O5SsKB003kFV vw8mVHMItDiDK80Y0fypJtVnCbz0nVgiA8hhwTtS8Z0P9RQNDMx/e6Bvtbg3fUwg7eQ6 LV9V0EQkov4X9cnFcnhamL8xBHa3Bg43UkwmS008cg4YPuC8ZGjfZd1M2QzKlgCab74O QXe0gZUrTscSTEaGA7X+ypVmMvlW4B5tfMa1lGsuIsGW2rhGdZdS/xG+guvXtQML5Xok Bsdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=of152Ns5; 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 r15-20020adfce8f000000b0020cff53e25asi50965wrn.288.2022.05.13.19.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:36:25 -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=of152Ns5; 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 ABF1F33754D; Fri, 13 May 2022 17:48:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354290AbiELVFP (ORCPT + 99 others); Thu, 12 May 2022 17:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239241AbiELVFO (ORCPT ); Thu, 12 May 2022 17:05:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E742427D00A for ; Thu, 12 May 2022 14:05:12 -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 A026AB80AEA for ; Thu, 12 May 2022 21:05:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43F39C385B8; Thu, 12 May 2022 21:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652389510; bh=8b8yIycXYuwnaJ406/9sz6HbsqXEqBJ0DuflynEfHaA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=of152Ns5DycT3vO6iszfj6AWOFGbEbDPjkhrOYNdImgrcMooMjA4MvdWcDG6Y/PM1 Tm5f0kPtcl5UtZY40pcVAtSo69hcG4DuUnkFb/8s1FRGOPInWaxrp3Ed/2tr5YycR7 /oMvQM1VEZX/i2o9ebq1wkLyRE6PHLU4njRcAPxmF+yuVijvjyEkajceNCXPnQVCxj rYmH/DgoneaW61+a4Dko/g0QHVLPmqT9KZwjqwqYANzRHzzPdu/s6vGil0UwP5mL8a asRonNPdJZsAEs4Sncc/cx7P+bJlI6ktJglh6Y2J8Dj+FFxCALm1WvJaTgjikHU3r8 u4gcRx2NJSo7Q== Date: Thu, 12 May 2022 14:05:08 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH 4/5] f2fs: do not stop GC when requiring a free section Message-ID: References: <20220506232032.1264078-1-jaegeuk@kernel.org> <20220506232032.1264078-4-jaegeuk@kernel.org> <77e870dd-fd7a-f58e-79fb-d0e5b8fbfc16@kernel.org> <42c23c83-1914-e8dd-c765-df3d6d872532@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 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 On 05/12, Chao Yu wrote: > On 2022/5/12 0:47, Jaegeuk Kim wrote: > > > > > > @@ -147,6 +147,7 @@ static int gc_thread_func(void *data) > > > > > > gc_control.init_gc_type = sync_mode ? FG_GC : BG_GC; > > > > > > gc_control.no_bg_gc = foreground; > > > > > > + gc_control.nr_free_secs = foreground ? 1 : 0; > > [snip] > > > > > I mean gc_control->nr_free_secs should be 0. > > [snip] > > > > > > > @@ -528,7 +528,8 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) > > > > > > .init_gc_type = BG_GC, > > > > > > .no_bg_gc = true, > > > > > > .should_migrate_blocks = false, > > > > > > - .err_gc_skipped = false }; > > > > > > + .err_gc_skipped = false, > > > > > > + .nr_free_secs = 1 }; > > Oh, so, in above two paths, when .nr_free_secs is 1, no_bg_gc should be true > to keep skipping BG_GC flow. > > How about adding a check condition in f2fs_gc() to avoid invalid argument > usage in future? Sent out v2. Could you please check? > > From: Chao Yu > > --- > fs/f2fs/gc.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 385282017317..a98276fd3cc1 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1799,10 +1799,19 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) > gc_type = FG_GC; > } > > - /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */ > - if (gc_type == BG_GC && gc_control->no_bg_gc) { > - ret = -EINVAL; > - goto stop; > + if (gc_type == BG_GC) { > + /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */ > + if (gc_control->no_bg_gc) { > + ret = -EINVAL; > + goto stop; > + } > + /* > + * BG_GC never guarantee that blocks are migrated synchronously. > + */ > + if (gc_control->nr_free_secs) { > + ret = -EINVAL; > + goto stop; > + } > } > retry: > ret = __get_victim(sbi, &segno, gc_type); > -- > 2.25.1 > > > > Thanks,