From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 54DC31FF0E5 for ; Wed, 15 Jul 2026 12:26:41 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 184DB21448; Wed, 15 Jul 2026 12:26:41 +0200 (CEST) Message-ID: <31f632e0-cb46-4fcb-be42-d2d012a42fdc@proxmox.com> Date: Wed, 15 Jul 2026 12:26:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH storage v9 2/5] lvm: saferemove: zero out volumes range by range To: Lukas Sichert , pve-devel@lists.proxmox.com References: <20260713160008.121125-1-l.sichert@proxmox.com> <20260713160008.121125-3-l.sichert@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20260713160008.121125-3-l.sichert@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784111149291 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.257 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: RZMANSCQEDSUF2DJTV64NYJJYQGBHT4L X-Message-ID-Hash: RZMANSCQEDSUF2DJTV64NYJJYQGBHT4L X-MailFrom: f.ebner@proxmox.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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Am 13.07.26 um 6:00 PM schrieb Lukas Sichert: > 'saferemove' currently uses different full-volume zero-out paths: > `blkdiscard --zeroout` for devices with write-zeroes support and > `cstream` otherwise. This makes consistent progress reporting and > throttling difficult and prevents interleaving future discard cleanup > with zeroing. On thin-provisioned backing storage, zeroing the whole LV > first can force unnecessary allocation. > > Move zeroing into an explicit range loop. Use BLKZEROOUT when supported, > cap to the device limit, and fall back to manually writing zeroes via > syswrite otherwise. Add progress reporting in the shared loop, and apply > a configured saferemove throughput limit there as well. Without an > explicit limit, keep BLKZEROOUT unthrottled and throttle only syswrites > to 10 MiB/s. Redefine saferemove_throughput as integer instead of string > to catch configuration errors with the schema already. > > Signed-off-by: Lukas Sichert With some more comments: Reviewed-by: Fiona Ebner > + } elsif ($zeroout_variant eq 'syswrite') { > + # if the $offset is 0, sysseek can return 0, therefore use // to only > + # throw an error, if it returns undef > + sysseek($fh, $offset, SEEK_SET) // die "sysseek failed: $!\n"; > + > + # use or as we also want to die if no progress was made, i.e. if $written is 0 > + $written = syswrite($fh, $zeroes, $stepsize) > + or die "syswrite failed: $!\n"; > + > + while ($written < $stepsize) { > + my $remaining = $stepsize - $written; > + my $retried_write = syswrite($fh, $zeroes, $remaining) Nit: while it doesn't matter since the buffer is all zeroes, you should specify the fourth argument for syswrite() for the offset within the buffer. Or add a quick code comment stating that it's not necessary here. > + or die "syswrite failed: $!\n"; > + $written += $retried_write; > + } > + > + } > + $written_total += $written; > + > + my $curr_time = time(); > + if (($curr_time - $lastprint) >= 3) { > + my $percent_finished = 100 * $written_total / $size; > + my $curr_seconds = $curr_time - $start; > + > + printf( > + "zeroed out %s of %s (%.2f%%) using %s in %s seconds\n", Note that render_duration() already includes the time unit, so there should be no "seconds" here. > + render_bytes($written_total), > + render_bytes($size), > + $percent_finished, > + $zeroout_variant, > + render_duration($curr_seconds), > + ); > + $lastprint = $curr_time; > + } > + > @@ -494,8 +568,8 @@ sub properties { > type => 'integer', > }, > saferemove_throughput => { > - description => "Wipe throughput (cstream -t parameter value).", > - type => 'string', > + description => "Wipe throughput in bytes.", > + type => 'integer', > }, Nit: I'd prefer this to be its own patch.