Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2401198rdb; Tue, 14 Nov 2023 22:29:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9psz4afNqblJ92Ckc44hc40UdKzLjwjG55kF1imwwRifBi3nTnfw4uFEYzL6SqKNG9KfQ X-Received: by 2002:a05:6358:e4aa:b0:168:ec90:95dd with SMTP id by42-20020a056358e4aa00b00168ec9095ddmr6139169rwb.26.1700029763888; Tue, 14 Nov 2023 22:29:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700029763; cv=none; d=google.com; s=arc-20160816; b=fi2OD0Qr7cjl+Q8wrcq9wOd9VUqxGb7Tb782cL7MnFG5YOSdHKQQ80TDLXACcue165 MMbgJCtF8JI+XhghY9Y5CzH79lfq/LEHxx5h5xWREqjcczASCsbDJoLQUhjT7SxChIK5 qNcYnb5Gdp7o8ky/bMZTnOhV7cF0GBu9AyMtqLMZHlgvX5XrfWB9skvNC3ti5x27GaxP EaTOAUkrr/w/quUKDjqp6ZU9uuslPZAvs4pSKThNuBGbv6osVhWzj4pWGsp7E2LXfohc fjRgixVwV3GBa0V/IiDT4I07IXQw+2z+rka5QIzERWlN73yDHKKhwjAdUdiznLxgOeru WtlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Jf/B5Oc/WzvvUdFmnUBFud6eMGY4eARI7RldZTjwxOg=; fh=imjFzjLG4qph4h5QWRTC1cq+KRDJyzf1iF2L5GqgaZs=; b=R6K1eZHu0GySkr7KJ3CbUgwcOSi9v9wJgzt0XnSAG3IKTIJ3VaoXTYGnKOFQHFXmGb ZCBSECJfCsH8sF4ZSF9RdEKLxUHrfXfW9T6lTxmSmf2m793H4DXAmIs4uxn6l9MADOR7 qeV4fS4SYIeOIAa5YGEIevIX+dx5urblPRQvbHKM2NojDfS/0/6r0dVbV/LysyMOOKqA ctUFHjZ7gAtzMwSQi10XGuUgzt5/d5PfBHdQEA/moAqU9mQi8UX/JiQ9H6csRyeT3GPk XOBAPapNtiy50zKjBASOGd02K/xSbzvf444QRBbCieRNyyTEFCu4NGkWicvpgur3YF4Y KzZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BrdbpUmo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u9-20020a632349000000b0059bdf5a4ecfsi9265932pgm.247.2023.11.14.22.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 22:29:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BrdbpUmo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 061D780963A8; Tue, 14 Nov 2023 22:29:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234570AbjKOG3F (ORCPT + 99 others); Wed, 15 Nov 2023 01:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbjKOG3E (ORCPT ); Wed, 15 Nov 2023 01:29:04 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B70E5D9 for ; Tue, 14 Nov 2023 22:29:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E0F8C433C7; Wed, 15 Nov 2023 06:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700029741; bh=L8aS70wCeZHXd9bSYTpdvYQwgG0Gn4rLS8gBbZvlwHY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BrdbpUmo27fDVhHtmSsHprxs9HvkdzIYcfuhcpJ0Ab63OtZ+7RLbCS/zTCqwT8phM ijNqjG7lzVSgmePPnk6eoerp5tCWJRNoCIk/q9gXPeFAoV04nxFkc61lmQLYcTXsse qKr3tB8bSIEEL49kQC/xHLIAjOUMc2dxD+yOnNBI5JyJUlFa1SC25mgXQgv8Ndd08X yxSkolJujqdwQEOfMx5ZV5bamvDrE0gR8y4EZbZ8z0ZC59e9iRZEew3rNlVPCYSgBP xFN5MpMoQK4v4I0q+XRnPH4VOqf0YFP54FfVZONyuQ3/h83zmZmdpej4N31vDBNL0n fT99yXCMww4eA== Message-ID: <236866a2-41b0-2ad0-db77-4c377367c80e@kernel.org> Date: Wed, 15 Nov 2023 14:28:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists Content-Language: en-US To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20231114212414.3498074-1-jaegeuk@kernel.org> <4a0e1c6f-12c4-f3dd-bb26-4bf0aee6be4b@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 14 Nov 2023 22:29:21 -0800 (PST) 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? > > 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; >>> } >>> }