Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp312966rwb; Fri, 4 Aug 2023 13:10:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECi8VPc4I3SozSzdLfzV8WH3QfuIWUEhFFS/eGsmlYrAjP2w5PrRL2eRkuhEOVzP2SlZYP X-Received: by 2002:a17:907:7857:b0:99c:5623:a8fb with SMTP id lb23-20020a170907785700b0099c5623a8fbmr2513540ejc.18.1691179841451; Fri, 04 Aug 2023 13:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691179841; cv=none; d=google.com; s=arc-20160816; b=sY0bcbkGwKNt5714OIavcXPr6ct8Jn7FehBTI5xLCn73BkhXBxgUSRtKVT0a5bJ5Tm uZqqNL6J6cY77RRc7Pxo7FP3oXuCQce5EOwEFLR/mcgUMqW4h6rpWF6a+qapPWYR1dCp pDwa3TuzKyYvG4xLqzLeFAyS5i6ze2ADnPcfPcvZcYBsbgAQt1HuWdshV5ZFzZLtZuKQ 0AmSHqPArjqOnjPxce5FImPHA2hd/OumJ8AZUQrL54jX0Zj72oKL0GtTDbvIMlDlVqcd w3Ix/l4iNCI9i4Pkomf80a/gZcE2TV9YnUH18QITGWtwZoAlIO4LtFPXF5Oaq4Fg0bAg wGaA== 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=BcYgVt7EGVmyAdthQiE34Zblhe+pa+ZTMqfq9GxiId8=; fh=xQWyI8xR8ECLaCGV6U1cPFN640Nawf460ksxGlugDI4=; b=u34Efpwj/3zzinX8TPdm+ytkj8DB4up+hcX1e7uQUTUAbSMezj+fV0xmdqd+UycIKH cWaK7L/NWD2ZvFLhJUJO8nFpL1waw9TSpI23ajig8wzlQF8WqafzT4RPIptiIYf14AEz vUZbS1sJ4wwVuzM0F3mp2/+gbsZ+3e8hVwJlEaLd4NImXyUd8YOjO4G4LiSBOUNn0Obc y68YZHJj9/vw2PXRETLF6PoGOTMPFVt49JJF2vWQOwwzPBD5DgeYnmkyJjtOq7Zn1vRt +dnl/PLypsf1kenZCiBVM+VnHCPGxuIorZsPfKBdwnd7qH8jSjOcpjS6pfKA3uDKhzYM 8IVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AmgohbXm; 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 kg9-20020a17090776e900b0099c971ba282si1735444ejc.99.2023.08.04.13.10.15; Fri, 04 Aug 2023 13:10:41 -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=AmgohbXm; 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 S230052AbjHDTVn (ORCPT + 99 others); Fri, 4 Aug 2023 15:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjHDTVm (ORCPT ); Fri, 4 Aug 2023 15:21:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7436E7 for ; Fri, 4 Aug 2023 12:21:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 549DC620F9 for ; Fri, 4 Aug 2023 19:21:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88680C433C7; Fri, 4 Aug 2023 19:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691176900; bh=MWsb2DdQYJWtGNKDyuUQFngOkZf1+l6/DVDp5rm0/EU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AmgohbXmO42MLHw37bUmYKkYI3JQmG8/8uqnf66nwVAxRF925dnb1Xs99X1nJ7DwA E7y+uLv8ynN/3yiWE0I2dbvgRVegQ5Hqle7MbmQSsvY2jACPTL0mjxClN01yEwR5XL LzQ+Qr67yVjKLJ1TwIXQ3OLrvt2za321FNaUjG67g1Debm2ty4WoomGa+6tdK6vGsi 9ceVc6h/4OJDGo6EaoQ75YVR84CdKDUXIvtfKOFzjHfkTwFlHDdMdD/kmPjotHm9bQ DG50rXghJns43omeR9LCPyBxr/sNbHIm+RC6xPvYdEIAwsjg+O2ifJrRbbwQmFt1Wi Sj10LwdZDHTjg== Date: Fri, 4 Aug 2023 12:21:39 -0700 From: Jaegeuk Kim To: Shinichiro Kawasaki Cc: Chao Yu , "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , Damien Le Moal Subject: Re: [f2fs-dev] [PATCH] f2fs: clean up w/ sbi->log_sectors_per_block Message-ID: References: <20230523123521.67656-1-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 08/04, Shinichiro Kawasaki wrote: > On May 23, 2023 / 20:35, Chao Yu wrote: > > Use sbi->log_sectors_per_block to clean up below calculated one: > > > > unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT; > > Hello Chao, > > When I ran workloads on f2fs using v6.5-rcX with fixes [1][2] and a zoned block > devices with 4kb logical block size, I observe mount failure as follows. When > I revert this commit, the failure goes away. > > [ 167.781975][ T1555] F2FS-fs (dm-0): IO Block Size: 4 KB > [ 167.890728][ T1555] F2FS-fs (dm-0): Found nat_bits in checkpoint > [ 171.482588][ T1555] F2FS-fs (dm-0): Zone without valid block has non-zero write pointer. Reset the write pointer: wp[0x1300,0x8] > [ 171.496000][ T1555] F2FS-fs (dm-0): (0) : Unaligned zone reset attempted (block 280000 + 80000) > [ 171.505037][ T1555] F2FS-fs (dm-0): Discard zone failed: (errno=-5) > > The patch replaced "sbi->log_blocksize - SECTOR_SHIFT" with > "sbi->log_sectors_per_block". However, I think these two are not equal when the > device has 4k logical block size. The former uses Linux kernel sector size 512 > byte. The latter use 512b sector size or 4kb sector size depending on the > device. mkfs.f2fs obtains logical block size via BLKSSZGET ioctl from the device > and reflects it to the value sbi->log_sector_size_per_block. This causes > unexpected write pointer calculations in check_zone_write_pointer(). This > resulted in unexpected zone reset and the mount failure. > > I think this patch needs revert. What do you think? Yeah, applied the revert. > > [1] https://lkml.kernel.org/linux-f2fs-devel/20230711050101.GA19128@lst.de/ > [2] https://lore.kernel.org/linux-f2fs-devel/20230804091556.2372567-1-shinichiro.kawasaki@wdc.com/