From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 557701FF0AD for ; Sun, 18 Oct 2026 16:21:04 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 48E4621491; Sun, 18 Oct 2026 16:20:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792333242; x=1792938042; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=f2Jql2rQN/0/vQHkyYPCs03M6kD6M6Xsjxjya8rpugE=; b=CUa60au3XeZYlbmEfNpjkoJyZOiCBzBRyFCaYHzV0h5B3RBdDxtaBXRa6FRgjc/t08 uIWcGRBL51wQQhtT+oUvvmho2kCypWU5eTeXubdFPclpV8aBaODZZXMh/I24Dj0pZYqn sk0HnCD72TReIJM/3oo6NijmvUk/gb1IWRUUvGU3+1BDRK+ISzsuC5ZLNyXqQ3mCnAF4 8ywU2qyj9plEexYQEgs8ZP5e7bYrPcGxCMVPHmWQ5Z6R3k3WslYRhnbVf315LSLTc591 Vrz92pN+Tv4LnyTIgKzu4uJkEoDzT8L4vkYZxshwOhBlMyYcez6eY7KsqdZ90jsN9sWu egaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792333242; x=1792938042; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=f2Jql2rQN/0/vQHkyYPCs03M6kD6M6Xsjxjya8rpugE=; b=npfcTBM+9N1POVqxhSMvbnoGJOawB5uyec96QzpJ6Oquhh24WxzYDiOKz8/LQ2A4K0 vB3Jd8jjCSckztJmOSR2hu7QtkxurE9Gho+S1Unimo+qCishUP3lSUqO24cKPiVAKMFL cJuuRt8vdUu92BwdYBXjAsbyR5P1D0UN3ysYKH6j5ubN+rLG83mDov+8zXFC82pSX++J vuGLkN/89HfjN1rIh08D3stNmrrWGUUXOcCAdfrxTNUjzKE9biLjgPEeIuEz1RD7Gc10 a718huX5gAlYSiRq3C3HjHBTAFXqDnZwOg6SfreiBQVaBE3tmiRsOWdosxShDvCmGdhi np7w== X-Gm-Message-State: AFq9FYKILDRjaz/vBVScA6mr0tjbbEBQ2c5GRusdPyyhOtldqVWsNxat 2FQU2kp9omNN+EI+yQLrkePx+6gcLkOb2XB7iO2aXH8jmgB2VYcx5ohBwiU9JvjL X-Gm-Gg: AYBFou3DcsDs9QAMIpuCWy1Qn+INGVeDj7j31Ltt4VVo32QR3J00tVQIxpdRzUue/u9 YKOf+dpFoXw6cHkTLqd/Or6G797PdMOiQj/+fcDsxeAtXrP/8BKfwJyFKOCpe6gzDqnEtwi9O/k hG05Ug1s/aQ8hfAfGd3mt6oeg+ZqpMcTjBUU7a9TACE1VMiEGLud+eGoUqmi2SU/xx0W5kb+MKV HH1WKSkSriFnYSakdJtIFD7onTsdLtNVQQGWWBi6wukrgwHhzx+n0ORZwN+8aePArZG06jSQx3W bduAPReDlVrYSRr6DiRHk0RcTe8SF7Br+MuRqK4GJ5JflHvH72wMar1o2L40v+KVTATbCx/zAap 7OOQ6aB16ReItbJf7Lb4mKctjn7+CrrpzwuFp7EvVXG1m5BSGVLUaUOTpq5+K+2UB402H5xUY3Y /KhDL6or8UcynTwqwF/SbegR3DWJbGa9vkr4xNFdq1AaNLg03AxYyGDDJq4GKkApfJgc7GvLMMU T2iZEskNCkOVq1BZf8IbAEGX9PdqdEmqnYdTpSwYoA0lZbeqbo7egC+qYoyk/kEMFZz81tOSc0M PwqOr0k8 X-Received: by 2002:a17:90b:1d4d:b0:3ac:8ee5:e00f with SMTP id 98e67ed59e1d1-3acef538914mr4038054a91.57.1792333242022; Sun, 18 Oct 2026 07:20:42 -0700 (PDT) From: Alchemy Han To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage] btrfs: fix swapped filesystem ioctl constants Date: Sun, 18 Oct 2026 22:20:36 +0800 Message-ID: <20261018142036.39663-1-alchemylinux@gmail.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: HR666TNGFCERFSKXO2DO5AMJNXSNABDE X-Message-ID-Hash: HR666TNGFCERFSKXO2DO5AMJNXSNABDE X-MailFrom: alchemylinux@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Alchemy Han X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The FS_IOC_GETFLAGS and FS_IOC_SETFLAGS constants are swapped in the Btrfs storage plugin. Consequently, enabling the 'nocow' storage option does not set the NOCOW attribute on newly allocated RAW disk images. This can be reproduced by configuring 'nocow 1' on a Btrfs storage and allocating a new RAW image using 'pvesm alloc'. The resulting disk.raw does not have the NOCOW attribute. On x86-64 Linux, the correct ioctl constants are: FS_IOC_GETFLAGS = 0x80086601 FS_IOC_SETFLAGS = 0x40086602 The original constants were tested using Perl ioctl calls. Reading the flags after attempting to set FS_NOCOW_FL returned 0x00000000. With the corrected constants, the same test successfully returned 0x00800000. Fix the constants to make the NOCOW storage option work as intended. Signed-off-by: Alchemy Han --- src/PVE/Storage/BTRFSPlugin.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm index fa28592..37dd3a6 100644 --- a/src/PVE/Storage/BTRFSPlugin.pm +++ b/src/PVE/Storage/BTRFSPlugin.pm @@ -18,8 +18,8 @@ use PVE::Storage::DirPlugin; use constant { BTRFS_FIRST_FREE_OBJECTID => 256, FS_NOCOW_FL => 0x00800000, - FS_IOC_GETFLAGS => 0x40086602, - FS_IOC_SETFLAGS => 0x80086601, + FS_IOC_GETFLAGS => 0x80086601, + FS_IOC_SETFLAGS => 0x40086602, BTRFS_MAGIC => 0x9123683e, }; -- 2.56.0