From nobody Wed Aug 26 07:24:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1786455238; cv=none; d=zohomail.com; s=zohoarc; b=J+ivVy+SW5gp0bOr/m9/PEuPoUWu4jVX+BdcfGhmhv2jJERrREpWikPzVTY7iQ5O52FNdUvkfvZPyNq8jMPUHSANUh5+IzbfGkgIznMBK+NJOUypyUKeK0AMwuY6mS4mkEDxO3yVN3XiT+lYSBLSyrjtBNj6nNm89xJF+wud9bM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786455238; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Dus6fa5TdeyIy9yx0oWemFivbprhJ2rlQSCzJAWvIiU=; b=MY13mKfObf5pLSKwjF6V5KKEELoDSFUpqVUIfRHX0jgZhKkqjPHVNiY/2PeXcxIeHQMk0jPbXa6zkJqTf3eFzoHwVg8qgL7pAP9GclmJasb3JmVlpC14BSAZAAmdWtDaNLjoj2YNaHEK28KuwDzih0T/djnHCivVYyxYxEmOEms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786455238781128.38445129659192; Tue, 11 Aug 2026 06:33:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wtmbU-000518-EJ; Tue, 11 Aug 2026 09:33:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wtmb9-0004zt-0b; Tue, 11 Aug 2026 09:32:55 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wtmb7-0000nu-8Y; Tue, 11 Aug 2026 09:32:54 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 78A2E42D84; Tue, 11 Aug 2026 13:32:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80AD21F000E9; Tue, 11 Aug 2026 13:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786455163; bh=Dus6fa5TdeyIy9yx0oWemFivbprhJ2rlQSCzJAWvIiU=; h=From:To:Cc:Subject:Date; b=DwT2ai89iOaiJ/2u5e9aw3N5QiqtbV1JxMW1sDyFG/xxTfQtFd+p+FkGz+GVnZeKu 1UZrbPIHv3hQa3Yi5ACkK1lVjvg1Z8VzSOWNBRGF6eJVQqXFlVXdfcTiKzG4Xr8h7O nx2DpjLs1UdhTawLhLlfVPl76p6tfsrt5g8YJ4/XTLl252g7wMyd/a2xhCqdSB1XXW tDH8CXsXD72yyshNnwXqmEyA/jQAbyyWX34Kp7gBYq/2WhxQZNK/71mqWuu6tz8dQj g18cgby8YcRpWLSc04b+hIxZWGKUARKYMKcxyiW1EFp85qia3sAIvRfzA+OVdmsNFt K+dxqy28vifSw== From: Niklas Cassel To: Kevin Wolf , Hanna Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Sam Li , Stefan Hajnoczi , Damien Le Moal , Niklas Cassel Subject: [PATCH v2] file-posix: fix zone write granularity assignment for zoned block devices Date: Tue, 11 Aug 2026 15:32:36 +0200 Message-ID: <20260811133236.1290092-1-cassel@kernel.org> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=cassel@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.102, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1786455241166158500 Content-Type: text/plain; charset="utf-8" In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size. However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size. See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3Da805a4fa4fa376bbc145762bb8b09caa2fa8af48 In Linux, there is a zone_write_granularity sysfs property which abstracts this away, so let's make use of it. Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size. Reviewed-by: Damien Le Moal Fixes: a3c41f06d5a8 ("file-posix: add tracking of the zone write pointers") Signed-off-by: Niklas Cassel Reviewed-by: Stefan Hajnoczi --- Changes since v1: -Improved commit log. -Picked up tag. block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 3c985da94f..63c52b1044 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1495,7 +1495,7 @@ static void raw_refresh_zoned_limits(BlockDriverState= *bs, struct stat *st, bs->bl.max_append_sectors =3D ret >> BDRV_SECTOR_BITS; } =20 - ret =3D get_sysfs_long_val(st, "physical_block_size"); + ret =3D get_sysfs_long_val(st, "zone_write_granularity"); if (ret >=3D 0) { bs->bl.write_granularity =3D ret; } --=20 2.55.0