From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (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 lists.proxmox.com (Postfix) with ESMTPS id DDBE574BC4 for ; Tue, 22 Jun 2021 14:18:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D4F792700E for ; Tue, 22 Jun 2021 14:18:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id B282226FC8 for ; Tue, 22 Jun 2021 14:18:34 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8A10F461FE for ; Tue, 22 Jun 2021 14:18:34 +0200 (CEST) From: Wolfgang Bumiller To: pve-devel@lists.proxmox.com Date: Tue, 22 Jun 2021 14:18:23 +0200 Message-Id: <20210622121828.84178-5-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210622121828.84178-1-w.bumiller@proxmox.com> References: <20210622121828.84178-1-w.bumiller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.578 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [btrfsplugin.pm] URI_NOVOWEL 0.5 URI hostname has long non-vowel sequence Subject: [pve-devel] [PATCH v2 storage 4/5] btrfs: make NOCOW optional X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2021 12:18:35 -0000 Signed-off-by: Wolfgang Bumiller --- New in this version. It's a performance knob... PVE/Storage/BTRFSPlugin.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm index 072dfe0..1fe5db0 100644 --- a/PVE/Storage/BTRFSPlugin.pm +++ b/PVE/Storage/BTRFSPlugin.pm @@ -46,6 +46,19 @@ sub plugindata { }; } +sub properties { + return { + nocow => { + description => "Set the NOCOW flag on files." + . " Disables data checksumming and causes data errors to be unrecoverable from" + . " while allowing direct I/O. Only use this if data does not need to be any more" + . " safe than on a single ext4 formatted disk with no underlying raid system.", + type => 'boolean', + default => 0, + }, + }; +} + sub options { return { path => { fixed => 1 }, @@ -56,6 +69,7 @@ sub options { content => { optional => 1 }, format => { optional => 1 }, is_mountpoint => { optional => 1 }, + nocow => { optional => 1 }, # TODO: The new variant of mkdir with `populate` vs `create`... }; } @@ -311,7 +325,7 @@ sub alloc_image { } elsif ($fmt eq 'raw') { sysopen my $fh, $path, O_WRONLY | O_CREAT | O_EXCL or die "failed to create raw file '$path' - $!\n"; - chattr($fh, ~FS_NOCOW_FL, FS_NOCOW_FL); + chattr($fh, ~FS_NOCOW_FL, FS_NOCOW_FL) if $scfg->{nocow}; truncate($fh, $size * 1024) or die "failed to set file size for '$path' - $!\n"; close($fh); -- 2.30.2