From: Kevin Wolf <kwolf@suse.de>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <Laurent.Vivier@bull.net>
Subject: Re: [Qemu-devel] [PATCH 1/4] qcow2: Clean-up update_cluster_refcount().
Date: Thu, 06 Nov 2008 18:32:48 +0100 [thread overview]
Message-ID: <49132A40.7030105@suse.de> (raw)
In-Reply-To: <1225990557.6576.11.camel@frecb07144>
Laurent Vivier schrieb:
> pièce jointe document texte brut
> (0001-Clean-up-update_cluster_refcount.patch)
> Move some parts to alloc_refcount_block() and block cache
> checking to load_refcount_block().
>
> Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
> ---
> block-qcow2.c | 71 +++++++++++++++++++++++++++++++++++-----------------------
> 1 file changed, 43 insertions(+), 28 deletions(-)
>
> Index: qemu/block-qcow2.c
> ===================================================================
> --- qemu.orig/block-qcow2.c 2008-11-06 16:34:46.000000000 +0100
> +++ qemu/block-qcow2.c 2008-11-06 16:40:27.000000000 +0100
> @@ -2169,6 +2169,10 @@ static int load_refcount_block(BlockDriv
> {
> BDRVQcowState *s = bs->opaque;
> int ret;
> +
> + if (refcount_block_offset == s->refcount_block_cache_offset)
> + return 0;
> +
> ret = bdrv_pread(s->hd, refcount_block_offset, s->refcount_block_cache,
> s->cluster_size);
> if (ret != s->cluster_size)
> @@ -2189,11 +2193,8 @@ static int get_refcount(BlockDriverState
> refcount_block_offset = s->refcount_table[refcount_table_index];
> if (!refcount_block_offset)
> return 0;
> - if (refcount_block_offset != s->refcount_block_cache_offset) {
> - /* better than nothing: return allocated if read error */
> - if (load_refcount_block(bs, refcount_block_offset) < 0)
> - return 1;
> - }
> + if (load_refcount_block(bs, refcount_block_offset) < 0)
> + return 1;
Please retain the comment saying that 1 is not the correct value but we
default to allocated for safety if the block could not be read. I don't
think this is obvious.
Otherwise the patch looks fine to me.
Kevin
next prev parent reply other threads:[~2008-11-06 17:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081106165212.380421945@bull.net>
2008-11-06 16:55 ` [Qemu-devel] [PATCH 1/4] qcow2: Clean-up update_cluster_refcount() Laurent Vivier
2008-11-06 17:32 ` Kevin Wolf [this message]
2008-11-07 8:48 ` Laurent Vivier
2008-11-07 8:54 ` Kevin Wolf
2008-11-07 9:22 ` Laurent Vivier
2008-11-06 16:55 ` [Qemu-devel] [PATCH 2/4] qcow2: Allow update_cluster_refcount() to update several clusters refcount Laurent Vivier
2008-11-06 18:11 ` Kevin Wolf
2008-11-07 10:03 ` Laurent Vivier
2008-11-07 10:21 ` Kevin Wolf
2008-11-07 11:39 ` Laurent Vivier
2008-11-06 16:55 ` [Qemu-devel] [PATCH 3/4] qcow2: Align I/O access to l2 table and refcount block Laurent Vivier
2008-11-06 16:56 ` [Qemu-devel] [PATCH 4/4] qcow2: detect if no disk cache Laurent Vivier
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=49132A40.7030105@suse.de \
--to=kwolf@suse.de \
--cc=Laurent.Vivier@bull.net \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.