[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qe
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qemu-img.c |
Date: |
Tue, 24 Jan 2012 16:03:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
Am 18.01.2012 15:59, schrieb Stefan Hajnoczi:
> 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.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> cutils.c | 34 ++++++++++++++++++++++++++++++++++
> qemu-common.h | 2 ++
> qemu-img.c | 46 +++++++---------------------------------------
> 3 files changed, 43 insertions(+), 39 deletions(-)
>
> diff --git a/cutils.c b/cutils.c
> index a6ffd46..2ea9c3c 100644
> --- a/cutils.c
> +++ b/cutils.c
> @@ -303,6 +303,40 @@ void qemu_iovec_memset_skip(QEMUIOVector *qiov, int c,
> size_t count,
> }
> }
>
> +/*
> + * Checks if a buffer is all zeroes
> + *
> + * Attention! The len must be a multiple of 4 * sizeof(long) due to
> + * restriction of optimizations in this function.
> + */
Sounds like something to assert(), while you're touching the code.
Kevin
- [Qemu-devel] [PATCH v4 0/6] block: zero writes, Stefan Hajnoczi, 2012/01/18
- [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qemu-img.c, Stefan Hajnoczi, 2012/01/18
- Re: [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qemu-img.c,
Kevin Wolf <=
- [Qemu-devel] [PATCH v4 3/6] block: perform zero-detection during copy-on-read, Stefan Hajnoczi, 2012/01/18
- [Qemu-devel] [PATCH v4 6/6] qemu-io: add write -z option for bdrv_co_write_zeroes, Stefan Hajnoczi, 2012/01/18
- [Qemu-devel] [PATCH v4 2/6] block: add .bdrv_co_write_zeroes() interface, Stefan Hajnoczi, 2012/01/18
- [Qemu-devel] [PATCH v4 4/6] qed: replace is_write with flags field, Stefan Hajnoczi, 2012/01/18
- [Qemu-devel] [PATCH v4 5/6] qed: add .bdrv_co_write_zeroes() support, Stefan Hajnoczi, 2012/01/18