From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org
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 [thread overview]
Message-ID: <4F1EC854.30409@redhat.com> (raw)
In-Reply-To: <1326898793-20331-2-git-send-email-stefanha@linux.vnet.ibm.com>
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 <stefanha@linux.vnet.ibm.com>
> ---
> 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
next prev parent reply other threads:[~2012-01-24 15:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 14:59 [Qemu-devel] [PATCH v4 0/6] block: zero writes Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 1/6] cutils: extract buffer_is_zero() from qemu-img.c Stefan Hajnoczi
2012-01-24 15:03 ` Kevin Wolf [this message]
2012-02-06 15:37 ` Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 2/6] block: add .bdrv_co_write_zeroes() interface Stefan Hajnoczi
2012-01-24 15:16 ` Kevin Wolf
2012-02-06 15:50 ` Stefan Hajnoczi
2012-02-06 16:00 ` Kevin Wolf
2012-02-06 16:16 ` Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 3/6] block: perform zero-detection during copy-on-read Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 4/6] qed: replace is_write with flags field Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 5/6] qed: add .bdrv_co_write_zeroes() support Stefan Hajnoczi
2012-01-18 14:59 ` [Qemu-devel] [PATCH v4 6/6] qemu-io: add write -z option for bdrv_co_write_zeroes Stefan Hajnoczi
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=4F1EC854.30409@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).