Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp216261rwl; Thu, 23 Mar 2023 15:09:29 -0700 (PDT) X-Google-Smtp-Source: AKy350anm/FS5ltujsfrC7rswHM1+Ns8VBWjUCvA98ozBxFXyPyBze35c9MigvZmt34IQ+W8T4v7 X-Received: by 2002:aa7:c993:0:b0:500:4e0c:2b09 with SMTP id c19-20020aa7c993000000b005004e0c2b09mr881280edt.7.1679609369529; Thu, 23 Mar 2023 15:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679609369; cv=none; d=google.com; s=arc-20160816; b=QM4dNw+RMC7qfP7eqMjdWLPmNBR6yxAqsHD/nUT8qRfCHZ4hkMjd2zD1Vhw4o+holr OSG2Rl8s4Pzyo55kfDv1P0PuXAvdNxlm2uHQeHQlLGOnySmhudErn6FB9jsOoDAScYPy TbyekhRUC1YeJJX0F8K+7Ou4Y3QoYCmV7nvFPOR366r/6TEmLUi4zFLyGC1xEpRk9J8X 6UWEW7oTyyV9KlFSCXAFsRnofnrKYBWSvUnYknM9IcZ3dMnHtSeA2z9nUkkfP6iAgfYb y3Onq8syjdR6HzCAZZxDK95j4Adt9oLXEbUQuPKACceav76NQRR5TXqqH5R9CuuyWcHu yvlg== 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=cIZs61UQ4D9EsTpNjcOvLQrX2Fldl7RPq7n54QqVHvQ=; b=spx6o7JomR+MoAYQqjAsXqtwdYmXIvKxr0jyxQXCnKf4mrLP1cmRhv2GJWduwQ/x09 WD/Ju7Ft7wuVuzuX8HSATAZXKFR79VT6vefA9mhpRYEzZGmrHe3mcRrGzY3HXOXjnKGJ mdxQpKX0ZME4cQzKzF08nJN75L9ZtWScJiZDfIuZ71j68c20vzdhbi05cm0ixUAkW/dx tDyXibD7ap+3At1LmKllZ76IaxAlCA9jr2vxC+HZVz2wTkdXBdfkFAYmwHkmfqqOE/pP E9nQfrv+0pKc4JaNNvgLAybFVS+oz90srvxM+11lxdYLqC15ny8htl9FEDEsMvla3Fvl KZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dM6si4v4; 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 c18-20020aa7c752000000b004acbb9ce157si21186540eds.237.2023.03.23.15.09.04; Thu, 23 Mar 2023 15:09:29 -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=dM6si4v4; 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 S229752AbjCWWDb (ORCPT + 99 others); Thu, 23 Mar 2023 18:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjCWWDa (ORCPT ); Thu, 23 Mar 2023 18:03:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E764D13D5B for ; Thu, 23 Mar 2023 15:03:25 -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 64D75628DA for ; Thu, 23 Mar 2023 22:03:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FFCC433D2; Thu, 23 Mar 2023 22:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679609004; bh=goJ4V9EA3h8tpdyLAJRYYFW4knwa/WVSAHQH3lMkgl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dM6si4v4OoCcVcoOqAx/sf+oiBJriayq0sO2xzovDAAhA1uieRCpJ+hibfqxQNPit DZtNG4r/J+2QxBE1ZIQ4OAjC7j5fhaG4ID3GnLxWx3DR65KEmU0lUFhgfxwDJvbJ2W pQrl1k76LI5lcX+vizatOsawtmeOmSRuVzo6Q/hicdheeL0KC8ezRo/Gc7uwMO3yUG +Sck6h5dkveSi4cRMIwiFghdXLAYGGdOpKODWyDnRvOObjp55HQOnv4mL+7R05QlDP u0tojVrN1a2weuQCrJfgKUVePaBtlbujBovq+/+cNPRKK0A9oSWoLtfHegcVFxrmUB J7Uj6scixKeAg== Date: Thu, 23 Mar 2023 15:03:22 -0700 From: Jaegeuk Kim To: Chao Yu Cc: yonggil.song@samsung.com, "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1] f2fs: Fix discard bug on zoned block devices with 2MiB zone size Message-ID: References: <20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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. > > 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;