Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7755337rwl; Thu, 23 Mar 2023 08:19:02 -0700 (PDT) X-Google-Smtp-Source: AK7set8/p86EbrFBGw4QLavxr+dB2XBBnGIe5uXVhZ62K8AhKpIydOmNPxqDjFvu1l7xmhomnM3b X-Received: by 2002:aa7:cf11:0:b0:4fb:d620:bd27 with SMTP id a17-20020aa7cf11000000b004fbd620bd27mr11287210edy.23.1679584742067; Thu, 23 Mar 2023 08:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679584742; cv=none; d=google.com; s=arc-20160816; b=pS5/TPmuiVwG0XefC5+qiMwsTjtcAlMkN94zzlAmV8AMBd5eqdVBcgZdUiosGAdr2E Clt/bFrA2uED6mgfqj7hm8xihiryGGH6+/0Y8ZpSFhL4H2imxKt75wMd1r4EfvGxzXTi Umv/UKQWMjUXb2/XnnOQ7Tx2rJ7fsjQYQBxwGhxDgZFS8NHB1b614fiuAdV3yxEn+SA/ YLHtIiUbFwhF/+pv85zJkjkfuK/nNOPnSiBP5Hbtv1gEXBzb3X4Y3IkWWn5R0R8ATl/A EGEDTYQHB72LZP4Hop8OLH4p4Bei/URFQAP3IdOO2a1F7wvrQpIb7H7CDG22fAxwiLpS NWrQ== 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:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=GEuGO17c6ZOxfDOyHEIDFrFVggeAHgAndlfWuYGrDoA=; b=sV2RymHDQuDVlwD+ACL0bZmRv2iXRqpGNycLuq7Pz8DmuomeaBJKrNDUU0iaSc4lnP NwoxGwUsxA2St2q3knHiyZ6E7k5Ikt2bM0P6ZmjjDy48Y6WFCN3JSz2bmAB15sRXFV8Q TwGioH5keO0wINWRsEN8HlNmfSrWUnKsnsiDOdIMJ1yrDu7usR1yejOX6HHJIZpliSTe mSrWZHB6gYUlTKWyM/97+Ek7elZd6iZxUqviHdgeZOTH3/atNkANSuSA0r+4yzBHcJmT 98dRuQfUQdaUCZJZsfUo6+4X78XWf6YtepMTvd3YAL8LEpeFK1u0s0lFEgGEZddmksN+ jYVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a22tikQR; 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 i14-20020a170906a28e00b00930e86db8fdsi18526606ejz.938.2023.03.23.08.18.36; Thu, 23 Mar 2023 08:19:02 -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=a22tikQR; 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 S232018AbjCWPRs (ORCPT + 99 others); Thu, 23 Mar 2023 11:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231418AbjCWPRo (ORCPT ); Thu, 23 Mar 2023 11:17:44 -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 9FA0920A2D for ; Thu, 23 Mar 2023 08:17:43 -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 3C3D46279B for ; Thu, 23 Mar 2023 15:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A867FC433D2; Thu, 23 Mar 2023 15:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679584662; bh=QtIAtDLDIoKln0bsHHFK0vxtR/850kTuSdnFC8ym8bA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=a22tikQRQmcohKDLd6X39kaUMGIbozfwYExk+fQBxjKH/XmL7TPPhlmbbDl1PWygK PmF4dPhmvOyX0frC1rs9w11NZ86PWNFkdR9HzxGARg79XxM+0N8CW+oqfffLCM7uz5 Na2/CNoHUIrUPPkTbB2VFPUSoj7sSJXbINaKuPVNh+/u1Jk0zYOSlBVDVwOgif+a4h qmeWDX1bdF/P3TCIi9CDKa/M8d0pUmdkeiV8mbgP/mear1kbLz39SZgXUv9uqEGty4 3L2fEXLfcYqy0xpXf1Yms0jtWqJMm3somhV5MaY9swUZXvpndUVzYoE36T050fMguB xzbfKpvVYVXrQ== Message-ID: Date: Thu, 23 Mar 2023 23:17:38 +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: yonggil.song@samsung.com, "jaegeuk@kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" References: <20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7> From: Chao Yu In-Reply-To: <20230313094825epcms2p71e6cb549251dc55e8d202dd64b9913a6@epcms2p7> 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/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? 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;