[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qe
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c |
Date: |
Wed, 21 Dec 2011 09:43:55 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 |
On 12/21/2011 09:00 AM, Stefan Hajnoczi wrote:
> The qemu-img.c:is_not_zero() function checks if a buffer contains all
> zeroes. This function will come in handy for zero-detection in the
> block layer, so clean it up and move it to cutils.c.
>
> Note that the function now returns true if the buffer is all zeroes.
> This avoids the double-negatives (i.e. !is_not_zero()) that the old
> function can cause in callers.
Are there plans to improve the efficiency of buffer_is_zero to take
advantage of metadata about sparseness?
That is, there are cases where we can use metadata to prove a region of
a file is sparse, without having to read every byte within that region.
Now that this series is giving QED special metadata that marks a zero
cluster, it is faster to query if that metadata exists denoting a zero
cluster than it is to read the entire cluster and check for non-zero.
Likewise, with regular files, the kernel provides lseek(SEEK_HOLE) (or
the older, lower-level, ioctl(FS_IOC_FIEMAP)); which at least GNU
coreutils is using for efficient sparse detection in source files.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 0/6] block: zero writes, Stefan Hajnoczi, 2011/12/21
- [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c, Stefan Hajnoczi, 2011/12/21
- Re: [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c,
Eric Blake <=
- [Qemu-devel] [PATCH v3 3/6] block: perform zero-detection during copy-on-read, Stefan Hajnoczi, 2011/12/21
- [Qemu-devel] [PATCH v3 4/6] qed: replace is_write with flags field, Stefan Hajnoczi, 2011/12/21
- [Qemu-devel] [PATCH v3 2/6] block: add .bdrv_co_write_zeroes() interface, Stefan Hajnoczi, 2011/12/21
- [Qemu-devel] [PATCH v3 5/6] qed: add .bdrv_co_write_zeroes() support, Stefan Hajnoczi, 2011/12/21
- [Qemu-devel] [PATCH v3 6/6] qemu-io: add write -z option for bdrv_co_write_zeroes, Stefan Hajnoczi, 2011/12/21
- Re: [Qemu-devel] [PATCH v3 0/6] block: zero writes, Stefan Hajnoczi, 2011/12/21