Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2451840rwb; Sun, 6 Aug 2023 19:13:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS4Xsstc3nUA4AsRrawamanGE4b5j2NjcSyBoEwnLZSrD/WMEF5a6vJex7LVD7j+zEss/M X-Received: by 2002:a05:6a20:970b:b0:134:1b21:b2e9 with SMTP id hr11-20020a056a20970b00b001341b21b2e9mr6717073pzc.21.1691374429576; Sun, 06 Aug 2023 19:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691374429; cv=none; d=google.com; s=arc-20160816; b=KicSZ0QFfE+aD7nbUox5V3uILvbJ4+gvs3P/SUyDu2w+IYJVIaSCRHe2DeTq/u+rV1 9OiZPNgdrNLEjeYt7lmcClfJT7+7h7fhZF4fLzOjIh5Nnw0OI6D4Mdx+VapFvB1kYKEM 6ORN3cnUi9Zmh8P1Jp/5pHVm3MGnaUBgPmFJjWwXix3sSb9uBKs4YaIVv/mct+nH/j9p XLgd/TMuirla6BwSK0EcdFgAjRG8I7ep9Dx6Uag4xwOwHlPaeRkL2/433kjXGIgmwFkR 7eytkMnl0hpC5CaRshtgfmSunuvmsDFAVJB2zFLM6VG1VcWEF5v3rE+AzeNjYRdPnfcs SZKw== 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=6iNu/rZqsq2967/klR5CnER+WTCTsGQW6Fy09F65b4M=; fh=qZIfgQPdzk6VtvxUl+AIDkOFZ9lKlWIrgeRjObM4IhA=; b=emSs2g1aTvgSw50n1AMn3cnXs7lZKI4o7RMgztV5XSGHI+B7EZqaHUrTed2w1Z724z NHogPdc1HphpSGZNa4ClWpuuP/iBEcdj0xGB+Ag4Vdc4gOocr4OT/avjsUI5KDxI4dCk RxWbzy7nLfNEY0C8rcMISftIuPRTa8+4JPyrAaKIoMzJyx1xvKMurq7WKRc/4kYGYPWx 4kx6yw3P28TagrRrEwUJQNt+Y2tixGelBt/Dns6mcuW05K2KvxiWuDizQwGWHmiZba7f /tXwunP/1ukzY6s4byRnCxks2U0MauZNv5iwaFy6bWnZs/t/6ZjoXbJLDhPmTQTYz00T 8yjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCsKvEeI; 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 k12-20020a170902c40c00b001b8a69660c1si5157927plk.88.2023.08.06.19.13.37; Sun, 06 Aug 2023 19:13:49 -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=hCsKvEeI; 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 S229674AbjHGCID (ORCPT + 99 others); Sun, 6 Aug 2023 22:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjHGCIB (ORCPT ); Sun, 6 Aug 2023 22:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF4051701 for ; Sun, 6 Aug 2023 19:08:00 -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 7743F612FE for ; Mon, 7 Aug 2023 02:08:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E0EEC433C7; Mon, 7 Aug 2023 02:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691374079; bh=vEzRQjXv1ttsp5vdYXUk/AoSYOpDU/Q7NEu1H1UZQq0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hCsKvEeI+ES1k2p4uCYKudBehFAa7Mta/Px2N9VqjFRT4ZjKOyZpySoAlwJV8n9Os aoPng/Jrj6vmPom/o9mwXKXsV1UZOmEezUYtigJhF4Xwq6oUBHk3+kaxlC5bSMt+pr 7hL9cx2SoxFx1hQ8IKMEXKoUMjfAG3ttwr/I9bEY4FwrVTVhZE3knX70I4Hn/crfU5 9wFn5+tMFBgikj2pm/gg4bHBYiXJ1EauidipdUexDv3MF8SpCE4dji2F3z6HgHo5g4 xyrg2u0ZsX1MdofIRKqs1rZn7/Yu5Q46mrfphgZSYBU3Cg48fOAHmrkUKUU6Iau+mN w+XOdhDHY/Dyw== Message-ID: Date: Mon, 7 Aug 2023 10:07:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [f2fs-dev] [PATCH] f2fs: clean up w/ sbi->log_sectors_per_block Content-Language: en-US To: Shinichiro Kawasaki Cc: "jaegeuk@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , Damien Le Moal References: <20230523123521.67656-1-chao@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=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 2023/8/4 17:43, 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? Hi Shinichiro, Oh, my bad, I think we need to revert that patch. Thanks for the report! :) Thanks, > > [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/