public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: "DERUMIER, Alexandre" <alexandre.derumier@groupe-cyllene.com>,
	"pve-devel@lists.proxmox.com" <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH V3 pve-storage] lvm: use blkdiscard instead cstream to saferemove drive
Date: Mon, 20 Oct 2025 16:54:41 +0200	[thread overview]
Message-ID: <e488e31c-b77e-45a9-8488-cfa37db9f277@proxmox.com> (raw)
In-Reply-To: <efdea60f-1dbe-4912-acea-6a111087f367@proxmox.com>

Am 20.10.25 um 4:33 PM schrieb Fiona Ebner:
> Am 20.10.25 um 9:56 AM schrieb DERUMIER, Alexandre:
>> Hi Fiona, I'm going to fix all your comment for this patch
>>
>>
>>> +                my $write_zeroes_max_bytes =
>>> +                   
>>> file_read_firstline("$sysdir/queue/write_zeroes_max_bytes") // 0;
>>
>>>> According to the docs: "The value 0 means that REQ_OP_WRITE_ZEROES
>>>> is not supported.", so it makes sense as a fallback too. But do we
>>>> need
>>>> to handle that somehow below, i.e. can --zeroout still be used if the
>>>> reported value is 0? Or do we need to fall back to the old way of
>>>> doing it?
>>
>> I don't have read the code of blkdiscard yet (and don't have found
>> device without write zeroes support to test), but according to redhat
>> doc
>> https://www.ovirt.org/develop/release-management/features/storage/wipe-volumes-using-blkdiscard.html
>>
>> "There are no restrictions when using blkdiscard -z, although
>> blkdiscard performs roughly the same as dd if the storage does not
>> support write same."
>>
> 
> At a glance, the implementation of blkdiscard doesn't seem to have a
> fallback and will just exit with error if the BLKZEROOUT ioctl() fails:
> https://github.com/util-linux/util-linux/blob/stable/v2.41/sys-utils/blkdiscard.c#L303

I do have a device which reports 0, but the ioctl() does not fail for it:

root@enia / # cat /sys/block/dm-0/queue/write_zeroes_max_bytes
0
root@enia / # blkdiscard -z /dev/dm-0
root@enia / # strace blkdiscard -z /dev/dm-0 2>&1 | grep BLKZEROOUT
ioctl(3, BLKZEROOUT, [0, 1073741824])   = 0

Now looking into the kernel there is:

 *  If %flags contains BLKDEV_ZERO_NOFALLBACK, the function will return
 *  -EOPNOTSUPP if no explicit hardware offload for zeroing is provided.
 */
int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
		sector_t nr_sects, gfp_t gfp_mask, struct bio **biop,
		unsigned flags)

and blk_ioctl_zeroout() calls blk_ioctl_zeroout() with flags
BLKDEV_ZERO_NOUNMAP | BLKDEV_ZERO_KILLABLE, so AFAICT, there is a
fallback and the fallback will be used :)


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  parent reply	other threads:[~2025-10-20 14:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 12:08 Alexandre Derumier via pve-devel
2025-09-22 14:06 ` Fiona Ebner
2025-10-20  7:56   ` DERUMIER, Alexandre via pve-devel
     [not found]   ` <dd465feaf024d147accab248c89b101cef8df169.camel@groupe-cyllene.com>
2025-10-20 14:33     ` Fiona Ebner
2025-10-20 14:37       ` DERUMIER, Alexandre via pve-devel
2025-10-20 14:54       ` Fiona Ebner [this message]
     [not found]       ` <7835c5768097161a8bdb53890c15ad3e4d93c7ca.camel@groupe-cyllene.com>
2025-10-20 15:15         ` Fiona Ebner
2025-10-20 15:18           ` DERUMIER, Alexandre via pve-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e488e31c-b77e-45a9-8488-cfa37db9f277@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=alexandre.derumier@groupe-cyllene.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal