Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp685257rdb; Fri, 17 Nov 2023 09:41:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxA1TjuD4tYwmkbv6OhiPb+lqS8rbeP8qecbN2mn0J0Am9lz/BTGh6hwFwdsCSQxvIErT3 X-Received: by 2002:a05:6830:51:b0:6c0:9498:7a77 with SMTP id d17-20020a056830005100b006c094987a77mr12218642otp.32.1700242915835; Fri, 17 Nov 2023 09:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700242915; cv=none; d=google.com; s=arc-20160816; b=Gem12bcGpMr+eoKgEPiWsy/lvr/3RUdB0iZaVXUKpHKPltxX53VnWk3MPY04VWHfV3 sSz7poSVXmgijMUWAnZlNtQf6t9HDaaCWwCjnSwH44IUv7TbwoQx4tJwA9A7J3xiK63l kZ0NPRBSqCYBwFRYv2zDyy/QNP6AXT6hSic1KsAqzdCat3S+Irzy2Zai0j6e1QaK4Whc ATBpAXmd8RS/S2gSAhGDJnHvq0vzdhmVZnxtpZ6f4yl02A/YL1I8Hyx0GLrcaIWW+8pe gG0M78KnwShT2ydhSkz6Zr0dmNbLS+RQqiAkzvECvJ857Pr+qA/jFCo7Sa1znEFCNokA rNjw== 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=jmtEd5NC0ZmxjhBH9cougUeBMBfDCmi5XK4w+3wNXZ8=; fh=KuS+1UlV5gqHbJ37XPD8MCZ1v8KBm0nhjTGQI/haxiI=; b=sYliWj3RHff4ISjpPOkdEJAcYK0TfQiPNPR698HqqlZw6GDdZx7YKJUsBYOafWVd8Y 3nKIyBkeNaqUtFb5KdbdwkjwL+nuU+hrfEKCCVbMCL3scCbMU19SnyZtljAwAiA3Fwja kjWe40U1QlQtC4sZvXOmBmS1CUWzP5W7u5GhtymvesWxfwKZQCEZQiuwdFoj2ykPeI+N d7R2657cuYX+TUvJdY9IDeCoZTI2ZmwlBn4QDJEf31LPxpYNjQdUKabrgDeA60fnkbXE pdDK41wWOimIyEc4pKT0aUpGy01fxdrSJcKTEMzvJkPw5fctQMdyorIuZco2B+uBNtyQ jagQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cqy2H4wG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s3-20020a656443000000b005b16e351343si2295877pgv.241.2023.11.17.09.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 09:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cqy2H4wG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 570E38342FE0; Fri, 17 Nov 2023 09:41:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346146AbjKQRlo (ORCPT + 99 others); Fri, 17 Nov 2023 12:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbjKQRlm (ORCPT ); Fri, 17 Nov 2023 12:41:42 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2648A5 for ; Fri, 17 Nov 2023 09:41:39 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FED2C433C8; Fri, 17 Nov 2023 17:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700242899; bh=MER7uh+se/JwOjTPFGrER85ioNfg81q8jMULDAOSPNA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cqy2H4wG/EgkVRNDWyWbR5qlXsCjjanoSmXnv2CXByhpNRQylp1+7r0Av16pM79TA LqTHgMtBZtNdILI6SggFyPhd6b46+v1zyfhTaR0Kcfee+CFK0bRclQv9axkOKnkgOf kx0j57oi5JxZvxc1spaoBOMxGkf2NwfxZQod47XD8wgajmq0qCOQB+Lchv1l+YEcaV 6MPtqhCwkGTc+WAW4NbD5xOJ23ZNDpONRGk13uYnCIIyBdx4I7eiPUqCcBFECE1WRZ qoTR4FCP+APCZTDFPB8xv5Qb1Mwwn9kpjI1+CAkk37HbD8jaJUz7NnjGkxFT5Wrl5o F2LGQhKIMlpZA== Date: Fri, 17 Nov 2023 09:41:37 -0800 From: Jaegeuk Kim To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists Message-ID: References: <20231114212414.3498074-1-jaegeuk@kernel.org> <4a0e1c6f-12c4-f3dd-bb26-4bf0aee6be4b@kernel.org> <236866a2-41b0-2ad0-db77-4c377367c80e@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <236866a2-41b0-2ad0-db77-4c377367c80e@kernel.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 09:41:53 -0800 (PST) On 11/15, Chao Yu wrote: > On 2023/11/15 10:45, Jaegeuk Kim wrote: > > On 11/15, Chao Yu wrote: > > > On 2023/11/15 5:24, Jaegeuk Kim wrote: > > > > When recovering zoned UFS, sometimes we add the same zone to discard multiple > > > > times. Simple workaround is to bypass adding it. > > > > > > What about skipping f2fs_bug_on() just for zoned UFS case? so that the check > > > condition can still be used for non-zoned UFS case. > > > > Hmm, I've never seen this bug_on before, but even this really happens, it does > > I've never seen it was been triggered as well. > > > not make sense to move forward to create duplicate commands resulting in a loop. > > Agreed. > > It looks those codes were copied from extent_cache code base, do we need to fix > all cases to avoid loop? Not sure other cases yet.. let's do one by one, since I hit this in real. > > > > > So, the question is, do we really need to check this? Have we hit this before? > Not sure, just be worry about that flaw of newly developed feature can make > code run into that branch. > > Thanks, > > > > > > > > > Thanks, > > > > > > > > > > > Signed-off-by: Jaegeuk Kim > > > > --- > > > > fs/f2fs/segment.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > > > > index 727d016318f9..f4ffd64b44b2 100644 > > > > --- a/fs/f2fs/segment.c > > > > +++ b/fs/f2fs/segment.c > > > > @@ -1380,7 +1380,8 @@ static void __insert_discard_cmd(struct f2fs_sb_info *sbi, > > > > p = &(*p)->rb_right; > > > > leftmost = false; > > > > } else { > > > > - f2fs_bug_on(sbi, 1); > > > > + /* Let's skip to add, if exists */ > > > > + return; > > > > } > > > > }