qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V12 4/6] rename qcow2-cache.c to block-cache.c
Date: Tue, 11 Sep 2012 10:41:16 +0200	[thread overview]
Message-ID: <504EF92C.9050408@redhat.com> (raw)
In-Reply-To: <1344613185-12308-5-git-send-email-wdongxu@linux.vnet.ibm.com>

Am 10.08.2012 17:39, schrieb Dong Xu Wang:
> add-cow and qcow2 file format will share the same cache code, so rename
> block-cache.c to block-cache.c. And related structure and qcow2 code also
> are changed.
> 
> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
> ---
>  block.h                |    3 +
>  block/Makefile.objs    |    3 +-
>  block/qcow2-cache.c    |  323 ------------------------------------------------
>  block/qcow2-cluster.c  |   66 ++++++----
>  block/qcow2-refcount.c |   66 ++++++-----
>  block/qcow2.c          |   36 +++---
>  block/qcow2.h          |   24 +---
>  trace-events           |   13 +-
>  8 files changed, 109 insertions(+), 425 deletions(-)
>  delete mode 100644 block/qcow2-cache.c
> 
> diff --git a/block.h b/block.h
> index e5dfcd7..c325661 100644
> --- a/block.h
> +++ b/block.h
> @@ -401,6 +401,9 @@ typedef enum {
>      BLKDBG_CLUSTER_ALLOC_BYTES,
>      BLKDBG_CLUSTER_FREE,
>  
> +    BLKDBG_ADD_COW_UPDATE,
> +    BLKDBG_ADD_COW_LOAD,
> +

I don't think you should add new events, the existing ones should be
generic enough that you can reuse them. It's somewhat hard to see
without block-cache.c, though.

Can you make sure to have one patch with pure code motion, and a
separate one with the changes needed to make it work with add-cow? It
will help reviewers a lot.

>      BLKDBG_EVENT_MAX,
>  } BlkDebugEvent;
>  
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index e179211..335dc7a 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -28,6 +28,7 @@
>  #include "block_int.h"
>  #include "block/qcow2.h"
>  #include "trace.h"
> +#include "block-cache.h"
>  
>  int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size)
>  {
> @@ -69,7 +70,8 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size)
>          return new_l1_table_offset;
>      }
>  
> -    ret = qcow2_cache_flush(bs, s->refcount_block_cache);
> +    ret = block_cache_flush(bs, s->refcount_block_cache,
> +        BLOCK_TABLE_REF, s->cluster_size);

I think its better to pass s->cluster_size to the cache initialisation
instead of in each call of the cache function.

For the blkdebug events I guess it's possible as well to move this to
the initialisation, but I'd have to see the block-cache.c code to say
something specific about this.

> @@ -659,18 +669,16 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
>       * handled.
>       */
>      if (cow) {
> -        qcow2_cache_depends_on_flush(s->l2_table_cache);
> +        block_cache_depends_on_flush(s->l2_table_cache);
>      }
>  
> -    if (qcow2_need_accurate_refcounts(s)) {
> -        qcow2_cache_set_dependency(bs, s->l2_table_cache,
> -                                   s->refcount_block_cache);
> -    }
> +    block_cache_set_dependency(bs, s->l2_table_cache, BLOCK_TABLE_L2,
> +        s->refcount_block_cache, s->cluster_size);

What happened with lazy refcounting? Is this a mismerge or did you
intentionally remove the condition? (There's a second place where you do
the same)

Kevin

  parent reply	other threads:[~2012-09-11  8:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 15:39 [Qemu-devel] [PATCH V12 0/6] add-cow file format Dong Xu Wang
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 1/6] docs: document for " Dong Xu Wang
2012-09-06 17:27   ` Michael Roth
2012-09-10  1:48     ` Dong Xu Wang
2012-09-10 15:23   ` Kevin Wolf
2012-09-11  2:12     ` Dong Xu Wang
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 2/6] make path_has_protocol non-static Dong Xu Wang
2012-09-06 17:27   ` Michael Roth
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 3/6] qed_read_string to bdrv_read_string Dong Xu Wang
2012-09-06 17:32   ` Michael Roth
2012-09-10  1:49     ` Dong Xu Wang
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 4/6] rename qcow2-cache.c to block-cache.c Dong Xu Wang
2012-09-06 17:52   ` Michael Roth
2012-09-10  2:14     ` Dong Xu Wang
2012-09-11  8:41   ` Kevin Wolf [this message]
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 5/6] add-cow file format Dong Xu Wang
2012-09-06 20:19   ` Michael Roth
2012-09-10  2:25     ` Dong Xu Wang
2012-09-11  9:44       ` Kevin Wolf
2012-09-11  9:40   ` Kevin Wolf
2012-09-12  7:28     ` Dong Xu Wang
2012-09-12  7:50       ` Kevin Wolf
2012-08-10 15:39 ` [Qemu-devel] [PATCH V12 6/6] add-cow: add qemu-iotests support Dong Xu Wang
2012-09-11  9:55   ` Kevin Wolf
2012-08-23  5:34 ` [Qemu-devel] [PATCH V12 0/6] add-cow file format Dong Xu Wang

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=504EF92C.9050408@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wdongxu@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).