On Wed, Jun 19, 2024 at 2:18 PM Nir Soffer <nsof...@redhat.com> wrote: > On 19 Jun 2024, at 8:54, Justin <just...@safe-mbox.com> wrote: > > I've run strace and I see calls to fallocate with these flags: > FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE > > I've tried passing these options: discard=off,detect-zeroes=off but > this does not help. This is the full set of relevant options I'm > using: > > -drive file=/vms/vm0/drive,format=raw,if=virtio,discard=off,detect-zeroes= > off > > You don't need to disable detect-zeros - in my tests it makes dd if=/dev/zero > 5 times faster (770 MiB/s -> 3 GiB/s) since zero writes are converted to > fallocate(FALLOC_FL_KEEP_SIZE|FALLOC_FL_ZERO_RANGE). > > The issue seems to be ignoring the discard option when opening the image, > and is fixed by this: > https://lists.nongnu.org/archive/html/qemu-block/2024-06/msg00198.html > > Thanks. When might this patch (or something similar) be merged? > > The patch need more work, when the work is done and qemu maintainers are > happy it is a good estimate :-)
Justin, v3 should be ready now, do you want to help by testing it? v3: https://lists.nongnu.org/archive/html/qemu-block/2024-06/msg00644.html You can also pull it from: https://gitlab.com/nirs/qemu/-/tree/consider-discard-option Nir