Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp209582rwl; Sat, 25 Mar 2023 00:33:09 -0700 (PDT) X-Google-Smtp-Source: AK7set9nA+9cygyORHqqhiGSneUfqrFP7NPNO7+XvXfSFsk4dBJC6zpcGpJaMfwW0qGkLHsUPWlT X-Received: by 2002:a05:6402:36e:b0:500:2a9d:1870 with SMTP id s14-20020a056402036e00b005002a9d1870mr12206527edw.13.1679729589320; Sat, 25 Mar 2023 00:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679729589; cv=none; d=google.com; s=arc-20160816; b=dmDol3+3GCZMsU5CiM5jnIH5EQ33vQPhmXM/ZQNe9pva8IM3xS2RQKLq/gJq5N4rGf q5Yl3Bnpq65/qL/XY8KCF2gVixpJJj9vCFjqcvZCq4uZV3EUvSp6B+q9cn9l6vFvritS sGHoKnMKB5q6XeZa/xi7Bsm2TY/omwEVl+k/TzxgcgLa/SAuNPlatgMkRCypTnkkrb+k 3AnZlxckvwkEpwywTu8l0XcTtCFnGAnezBT65GyvAWN4Y0Y9gqrBzO8eTDV1Zwbzc4+J rQZCF7qWk++I3F57s2TSIxJzRbB4OyvVM8tHXgGDnb1v4RloKPsB4nXJdouX37Dqv2ce 2t6w== 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=4Ze8rHxbigDT8IAV+tt7HDmcHC7b8ZsYEKfCm+5DaHU=; b=1EOmATK8M6K2JnV9Wbla3GArFqCWlosZY+7ZcHOHTEAfRQRxi/nWwNXA+ccdulS2Bj wa46plT0+IYiHX241PJWrfmZZ9VYfs1SNOnNoXVxlRDShWgrtRX9lRe6Ua9lJ0cysfQC QT1FZLF5J86egb5yH4utzRV5+P+MxWwVsuMA5xl19hbvhRBzlbvPEUSeaG51ZBzrNq8+ b1+FWbXsGpo3IfbsJFGSt+18pBrc+dliYnZryR8KzbYkkLt2MMIc5GvSar1xnhHuEqpo WxQLjl9UO+2uWInOqlTHcmvGG+WAOGfUs4JiLuYYiUK0HZWjNIkf0ojJDicQpZJAVkeW Lvqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="S8j7Jo+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a05640214c800b00501d4f93130si14531215edx.646.2023.03.25.00.32.45; Sat, 25 Mar 2023 00:33:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="S8j7Jo+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbjCYHZt (ORCPT + 99 others); Sat, 25 Mar 2023 03:25:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjCYHZs (ORCPT ); Sat, 25 Mar 2023 03:25:48 -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 440FA423A for ; Sat, 25 Mar 2023 00:25:47 -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 A9860B81212 for ; Sat, 25 Mar 2023 07:25:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A97B9C433EF; Sat, 25 Mar 2023 07:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679729144; bh=ntEalkUYAGwjABuQ56Tv6dEUJ7uXtdZVc6w4gHVNPp0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=S8j7Jo+/Py1QDPuJxYBwBV5JXrI0Yk63/fCXos0cWxtd0BYDsMFZgyRyZMw7hS3Ue 7CRsh5nNqKuuy3tDaXJj0id7BSq/YrJeIHNEcryYRpNHjZQIrZM4JWGnBNSrfi2vkb dlgMaMLt2kU0LPgy7TMvm54ZNH+kjC3BcLwgW1vTi9G3xpTeYTXkcRRWQZ+EMcZrUY opSFyUCnRlARr2RDqiP31x40LEcTg5K8xLs9NhOs47Qa2I3ynXIcdN6mu2MXEu4gm4 axAiHhp06eXBA3hPfFkl1HOFGInMxs36ZAlNeaZZgYTzpDz7ahP5ALtP4RKsOXcWxR Kf3yCKGht1Gkg== Message-ID: <7524b5b2-95c1-f39f-c375-bdfb55778c5d@kernel.org> Date: Sat, 25 Mar 2023 15:25:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size Content-Language: en-US To: Jaegeuk Kim Cc: yonggil.song@samsung.com, "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" References: <20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7> <35dd1eea-f1b9-418e-5f97-cfd10b7ff803@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=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 2023/3/25 0:54, Jaegeuk Kim wrote: > On 03/24, Chao Yu wrote: >> On 2023/3/24 6:03, Jaegeuk Kim wrote: >>> On 03/23, Chao Yu wrote: >>>> On 2023/3/13 17:48, Yonggil Song wrote: >>>>> When using f2fs on a zoned block device with 2MiB zone size, IO errors >>>>> occurs because f2fs tries to write data to a zone that has not been reset. >>>>> >>>>> The cause is that f2fs tries to discard multiple zones at once. This is >>>>> caused by a condition in f2fs_clear_prefree_segments that does not check >>>>> for zoned block devices when setting the discard range. This leads to >>>>> invalid reset commands and write pointer mismatches. >>>>> >>>>> This patch fixes the zoned block device with 2MiB zone size to reset one >>>>> zone at a time. >>>>> >>>>> Signed-off-by: Yonggil Song >>>>> --- >>>>> 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 acf3d3fa4363..2b6cb6df623b 100644 >>>>> --- a/fs/f2fs/segment.c >>>>> +++ b/fs/f2fs/segment.c >>>>> @@ -1953,7 +1953,8 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, >>>>> (end - 1) <= cpc->trim_end) >>>>> continue; >>>>> - if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) { >>>>> + if (!f2fs_sb_has_blkzoned(sbi) && >>>> >>>> Could you please add one line comment here for this change? >>> >>> This was merged in -dev a while ago. I don't think this would be critical >>> to rebase it again. >> >> Yes, it's not critical, fine to me. > > Added: > > /* Should cover 2MB zoned device for zone-based reset */ Thanks a lot for the change. :) Thanks, > > So lucky since I had to rebase to fix other patch. :( > > "f2fs: factor out discard_cmd usage from general rb_tree use" > > >> >> Thanks, >> >>> >>>> >>>> Otherwise it looks good to me. >>>> >>>> Thanks, >>>> >>>>> + (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) { >>>>> f2fs_issue_discard(sbi, START_BLOCK(sbi, start), >>>>> (end - start) << sbi->log_blocks_per_seg); >>>>> continue;