qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>,
	Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/6] add-cow file format
Date: Wed, 01 Aug 2012 16:21:05 +0200	[thread overview]
Message-ID: <50193B51.1050609@redhat.com> (raw)
In-Reply-To: <CAJSP0QUBq+J2U+X0E5h5uE91SWPU3sT6SDtcXiyB4PPUCexKRw@mail.gmail.com>

Am 01.08.2012 16:14, schrieb Stefan Hajnoczi:
> On Wed, Aug 1, 2012 at 2:57 PM, Eric Blake <eblake@redhat.com> wrote:
>> On 07/31/2012 10:51 AM, Dong Xu Wang wrote:
>>> This is the implementation code for add-cow file format. Because image_file
>>> might be very huge, then we can't read entire bitmap into memory, we must use
>>> a cache. Since qcow-cache.c has implemted cache code, we can create our cache
>>
>> s/implemted/implemented/
>>
>>> code based on it.
>>
>> Just wondering if Paolo's HBitmap code for drive-mirror might be a more
>> efficient way to implement your caching.
>>
>>>
>>> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
>>> ---
>>>  block/Makefile.objs   |    1 +
>>>  block/add-cow-cache.c |  206 +++++++++++++++++
>>>  block/add-cow.c       |  599 +++++++++++++++++++++++++++++++++++++++++++++++++
>>>  block/add-cow.h       |  101 +++++++++
>>>  block_int.h           |    2 +
>>
>> Rather than adding a new implementation for code duplication, can you
>> refactor the existing implementation to be reusable, and update
>> qcow-cache.c to call into the common refactored code?
> 
> I looked at this and block/qcow2-cache.c seems fairly clean and
> generic.  The only things that need to be parameterized are the
> s->l2_table_cache/s->refcount_block_cache and s->cluster_size.
> 
> These can be fixed by adding fields to Qcow2Cache:
> size_t table_size; /* cached table size in bytes */
> BlkDebugEvent flush_event;
> BlkDebugEvent load_event;
> 
> Or maybe a table type enum (L2/refcount blocks/bitmap blocks).
> 
> If Kevin agrees with extracting this from qcow2 (i.e. we can't add
> more qcow2-specific behavior easily in the future), then this looks
> doable.

I don't think we'd want to add qcow2 specific stuff there, and I've been
meaning to generalise it for quite a while, so feel free to do it.

One thing to note is that it currently depends on qcow2's s->lock being
taken while it's called. Eventually we'll want finer grained locking in
the cache itself and I believe this will also require some changes in
the interface, but for now add-cow can just do the same qcow2 and take
its global CoMutex.

Kevin

  reply	other threads:[~2012-08-01 14:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 16:51 [Qemu-devel] [PATCH 1/6 v11] docs: spec for add-cow file format Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 2/6 v11 v11] block: make some functions public Dong Xu Wang
2012-08-01 13:53   ` Eric Blake
2012-08-02  7:10     ` Dong Xu Wang
2012-08-01 14:01   ` Stefan Hajnoczi
2012-08-02  7:11     ` Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 3/6] add-cow file format Dong Xu Wang
2012-08-01 13:57   ` Eric Blake
2012-08-01 14:14     ` Stefan Hajnoczi
2012-08-01 14:21       ` Kevin Wolf [this message]
2012-08-02  7:20     ` Dong Xu Wang
2012-08-01 15:31   ` Stefan Hajnoczi
2012-08-02  7:20     ` Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 4/6 v11] add-cow: support snapshot_blkde Dong Xu Wang
2012-08-01 15:37   ` Stefan Hajnoczi
2012-08-02  7:28     ` Dong Xu Wang
2012-08-02 10:37       ` Stefan Hajnoczi
2012-07-31 16:51 ` [Qemu-devel] [PATCH 5/6 v11] add-cow: hmp and qmp interface Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 6/6 v11] add-cow: support qemu-iotests Dong Xu Wang
2012-08-01 13:51 ` [Qemu-devel] [PATCH 1/6 v11] docs: spec for add-cow file format Eric Blake
2012-08-02  7:03   ` Dong Xu Wang
2012-08-01 13:55 ` Stefan Hajnoczi
2012-08-02  7:09   ` Dong Xu Wang
2012-08-02 10:44     ` Stefan Hajnoczi
2012-08-03  5:56       ` Dong Xu Wang
2012-08-03  8:26         ` Stefan Hajnoczi
2012-08-06  2:05           ` Dong Xu Wang
  -- strict thread matches above, loose matches on Subject: below --
2012-06-13 14:36 [Qemu-devel] [PATCH 1/6 v10] " Dong Xu Wang
2012-06-13 14:36 ` [Qemu-devel] [PATCH 3/6] " Dong Xu Wang
2012-06-14 11:13   ` Paolo Bonzini
2012-06-18  2:08     ` 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=50193B51.1050609@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --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).