[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] qemu-img: Use zero writes afte
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] qemu-img: Use zero writes after source backing EOF |
Date: |
Thu, 18 Apr 2019 13:59:40 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 7/13/18 6:14 AM, Max Reitz wrote:
> Past the end of the source backing file, we memset() buf_old to zero, so
> it is clearly easy to use blk_pwrite_zeroes() instead of blk_pwrite()
> then.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> qemu-img.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> @@ -3458,8 +3461,12 @@ static int img_rebase(int argc, char **argv)
> if (compare_buffers(buf_old + written, buf_new + written,
> n - written, &pnum))
> {
> - ret = blk_pwrite(blk, offset + written,
> - buf_old + written, pnum, 0);
> + if (buf_old_is_zero) {
> + ret = blk_pwrite_zeroes(blk, offset + written, pnum,
> 0);
Should we allow BDRV_REQ_MAY_UNMAP here, either unconditionally, or
based on a command line knob that told us whether the user is more
interested in a sparse result (that still reads as zero) vs. a
fully-allocated result?
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] qemu-img: Use zero writes after source backing EOF,
Eric Blake <=