qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org,
	Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com>,
	stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com,
	jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/8] spec: add qcow2-dirty-bitmaps specification
Date: Wed, 10 Jun 2015 11:49:21 +0300	[thread overview]
Message-ID: <5577FA11.3080009@virtuozzo.com> (raw)
In-Reply-To: <5577F312.9040502@virtuozzo.com>

On 10.06.2015 11:19, Vladimir Sementsov-Ogievskiy wrote:
> On 09.06.2015 20:03, Stefan Hajnoczi wrote:
>> On Mon, Jun 08, 2015 at 06:21:19PM +0300, Vladimir 
>> Sementsov-Ogievskiy wrote:
>>> From: Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com>
>>>
>>> Persistent dirty bitmaps will be saved into qcow2 files. It may be used
>>> as 'internal' bitmaps (for qcow2 drives) or as 'external' bitmaps for
>>> other drives (there may be qcow2 file with zero disk size but with
>>> several dirty bitmaps for other drives).
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> ---
>>>   docs/specs/qcow2.txt | 66 
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>   1 file changed, 66 insertions(+)
>>>
>>> diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt
>>> index 121dfc8..0fffba2 100644
>>> --- a/docs/specs/qcow2.txt
>>> +++ b/docs/specs/qcow2.txt
>>> @@ -123,6 +123,7 @@ be stored. Each extension has a structure like 
>>> the following:
>>>                           0x00000000 - End of the header extension area
>>>                           0xE2792ACA - Backing file format name
>>>                           0x6803f857 - Feature name table
>>> +                        0x23852875 - Dirty bitmaps
>>>                           other      - Unknown header extension, can 
>>> be safely
>>>                                        ignored
>>>   @@ -166,6 +167,19 @@ the header extension data. Each entry look 
>>> like this:
>>>                       terminated if it has full length)
>>>     +== Dirty bitmaps ==
>>> +
>>> +Dirty bitmaps is an optional header extension. It provides a 
>>> possibility of
>>> +storing dirty bitmaps in qcow2 image. The fields are:
>>> +
>>> +          0 -  3:  nb_dirty_bitmaps
>>> +                   Number of dirty bitmaps contained in the image
>> Is there a maximum?
> hmm. any proposals for this?
>>
>>> +
>>> +          4 - 11:  dirty_bitmaps_offset
>>> +                   Offset into the image file at which the dirty 
>>> bitmaps table
>>> +                   starts. Must be aligned to a cluster boundary.
>> The autoclear feature bit is undocumented.
>>
>>>   == Host cluster management ==
>>>     qcow2 manages the allocation of host clusters by maintaining a 
>>> reference count
>>> @@ -360,3 +374,55 @@ Snapshot table entry:
>>>             variable:   Padding to round up the snapshot table entry 
>>> size to the
>>>                       next multiple of 8.
>>> +
>>> +
>>> +== Dirty bitmaps ==
>>> +
>>> +The feature supports storing several dirty bitmaps in the qcow2 file.
>>> +
>>> +=== Cluster mapping ===
>>> +
>>> +Dirty bitmaps are stored using a ONE-level structure for the 
>>> mapping of
>>> +bitmaps to host clusters. There is only an L1 table.
>>> +
>>> +The L1 table has a variable size (stored in the Bitmap table entry) 
>>> and may
>>> +use multiple clusters, however it must be contiguous in the image 
>>> file.
>> The use of "L1 table" could be confusing.  The refcount metadata uses
>> "refcount table" and "refcount block" to describe a one-level table.
> I agree. Hmm.. dirty bitmaps table? ok?
oh, no, bad idea. dirty bitmaps table is other thing))
>>
>>> +
>>> +Given an offset into the bitmap, the offset into the image file can be
>>> +obtained as follows:
>>> +
>>> +    offset = l1_table[offset / cluster_size] + (offset % cluster_size)
>> It might help to add granularity to this formula.
>>
>> Instead of "offset", "bit_number" or "bitnr" might be clearer since
>> "offset" means something different in other parts of the document.
> Hmm. In my opinion, the bitmap here is stored as raw data. And 
> granularity is an additional parameter (for deserializing this data). 
> So, it is an offset in bytes for this data. The format is not for 
> accessing bitmap bits, it's only for loading the whole bitmap one time.
>>
>>> +
>>> +L1 table entry:
>>> +
>>> +    Bit  0 -  61:   Standard cluster descriptor
>>> +
>>> +        62 -  63:   Reserved
>> Do you really want to use the standard cluster descriptor with it's zero
>> bit?
>>
>> Since bitmaps don't honor backing files there doesn't seem much point in
>> using the zero bit, things are simpler if just bits 9-55 are contain the
>> host cluster offset and 0 means the cluster is unallocated.
>>
>> By honoring the zero bit there are three states:
>> 1. Zero bit set, read zeroes
>> 2. Zero bit not set, host cluster offset != 0, bits valid
>> 3. Zero bit not set, host cluster offset == 0, unallocated
>>
>> State 1 is not useful.
>>
>>> +=== Bitmap table ===
>>> +
>>> +A directory of all bitmaps is stored in the bitmap table, a 
>>> contiguous area in
>>> +the image file, whose starting offset and length are given by the 
>>> header fields
>>> +dirty_bitmaps_offset and nb_dirty_bitmaps. The entries of the 
>>> bitmap table have
>>> +variable length, depending on the length of name and extra data.
>>> +
>>> +Bitmap table entry:
>>> +
>>> +    Byte 0 -  7:    Offset into the image file at which the L1 
>>> table for the
>>> +                    bitmap starts. Must be aligned to a cluster 
>>> boundary.
>>> +
>>> +         8 - 11:    Number of entries in the L1 table of the bitmap
>>> +
>>> +        12 - 15:    Bitmap granularity in bytes
>>> +
>>> +        16 - 23:    Bitmap size in sectors
>>> +
>>> +        24 - 25:    Size of the bitmap name
>>> +
>>> +        variable:   The name of the bitmap (not null terminated)
>>> +
>>> +        variable:   Padding to round up the bitmap table entry size 
>>> to the
>>> +                    next multiple of 8.
>>> +
>>> +The fields "size", "granularity" and "name" are corresponding with 
>>> the fields
>>> +in struct BdrvDirtyBitmap.
>> Referring to the internals of a C struct in QEMU is not appropriate for
>> a file format specification.  Please document the fields fully including
>> their constraints, minimums, maximums, etc.
>
>


-- 
Best regards,
Vladimir
* now, @virtuozzo.com instead of @parallels.com. Sorry for this inconvenience.

  reply	other threads:[~2015-06-10  8:49 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 15:21 [Qemu-devel] [PATCH v2 RFC 0/8] block: persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2015-06-08 15:21 ` [Qemu-devel] [PATCH 1/8] spec: add qcow2-dirty-bitmaps specification Vladimir Sementsov-Ogievskiy
2015-06-09 16:01   ` John Snow
2015-06-09 17:03   ` Stefan Hajnoczi
2015-06-10  8:19     ` Vladimir Sementsov-Ogievskiy
2015-06-10  8:49       ` Vladimir Sementsov-Ogievskiy [this message]
2015-06-10 13:00       ` Eric Blake
2015-06-11 10:16         ` Vladimir Sementsov-Ogievskiy
2015-06-10 13:24       ` Stefan Hajnoczi
2015-06-11 10:19         ` Vladimir Sementsov-Ogievskiy
2015-06-11 13:03           ` Stefan Hajnoczi
2015-06-11 16:21             ` John Snow
2015-06-12 10:28               ` Stefan Hajnoczi
2015-06-12 15:19                 ` John Snow
2015-06-10 15:34   ` Kevin Wolf
2015-06-11 10:25     ` Vladimir Sementsov-Ogievskiy
2015-06-11 16:30       ` John Snow
2015-06-12  8:33         ` Kevin Wolf
2015-08-24 10:46     ` Vladimir Sementsov-Ogievskiy
2015-08-24 13:30   ` Vladimir Sementsov-Ogievskiy
2015-08-24 14:08     ` Vladimir Sementsov-Ogievskiy
2015-08-24 14:04   ` Vladimir Sementsov-Ogievskiy
2015-08-31 22:21   ` Eric Blake
2015-08-31 22:24     ` John Snow
2015-06-08 15:21 ` [Qemu-devel] [PATCH 2/8] qcow2: add dirty-bitmaps feature Vladimir Sementsov-Ogievskiy
2015-06-09 16:52   ` Stefan Hajnoczi
2015-06-10 14:30   ` Stefan Hajnoczi
2015-06-12 19:02     ` John Snow
2015-06-15 14:42       ` Stefan Hajnoczi
2015-06-23 17:57         ` John Snow
2015-06-24  9:39           ` Stefan Hajnoczi
2015-08-14 17:14     ` Vladimir Sementsov-Ogievskiy
2015-08-26  9:09       ` Stefan Hajnoczi
2015-06-11 23:04   ` John Snow
2015-06-15 14:05     ` Vladimir Sementsov-Ogievskiy
2015-06-15 16:53       ` John Snow
2015-06-12 21:55   ` John Snow
2015-08-26 13:15     ` Vladimir Sementsov-Ogievskiy
2015-08-26 14:14       ` Vladimir Sementsov-Ogievskiy
2015-08-27 12:43   ` Vladimir Sementsov-Ogievskiy
2015-06-08 15:21 ` [Qemu-devel] [PATCH 3/8] block: store persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2015-06-08 15:21 ` [Qemu-devel] [PATCH 4/8] block: add bdrv_load_dirty_bitmap Vladimir Sementsov-Ogievskiy
2015-06-09 16:01   ` Stefan Hajnoczi
2015-06-10 22:33     ` John Snow
2015-06-11 10:41       ` Vladimir Sementsov-Ogievskiy
2015-06-08 15:21 ` [Qemu-devel] [PATCH 5/8] qcow2: add qcow2_dirty_bitmap_delete_all Vladimir Sementsov-Ogievskiy
2015-06-08 15:21 ` [Qemu-devel] [PATCH 6/8] qcow2: add autoclear bit for dirty bitmaps Vladimir Sementsov-Ogievskiy
2015-06-09 15:49   ` Stefan Hajnoczi
2015-06-09 15:50   ` Stefan Hajnoczi
2015-08-27  7:45     ` Vladimir Sementsov-Ogievskiy
2015-08-31 11:06       ` Vladimir Sementsov-Ogievskiy
2015-08-31 22:39       ` Eric Blake
2015-08-31 22:50         ` Eric Blake
2015-06-10 23:42   ` John Snow
2015-06-11  8:35     ` Kevin Wolf
2015-06-11 10:49     ` Vladimir Sementsov-Ogievskiy
2015-06-11 16:36       ` John Snow
2015-06-08 15:21 ` [Qemu-devel] [PATCH 7/8] qemu: command line option " Vladimir Sementsov-Ogievskiy
2015-06-11 20:57   ` John Snow
2015-06-12 21:49   ` John Snow
2015-06-08 15:21 ` [Qemu-devel] [PATCH 8/8] iotests: test internal persistent dirty bitmap Vladimir Sementsov-Ogievskiy
2015-06-09 16:17   ` Eric Blake
2015-06-10 15:27 ` [Qemu-devel] [PATCH v2 RFC 0/8] block: persistent dirty bitmaps Stefan Hajnoczi
2015-06-11 11:22   ` Vladimir Sementsov-Ogievskiy
2015-06-11 13:14     ` Stefan Hajnoczi
2015-06-11 20:06 ` Stefan Hajnoczi
2015-06-12  9:58   ` Denis V. Lunev
2015-06-12 10:36     ` Stefan Hajnoczi
2015-08-26  6:26       ` Vladimir Sementsov-Ogievskiy
2015-08-26  9:13         ` Stefan Hajnoczi
2015-06-12 19:34 ` John Snow
2015-06-17 14:29   ` Vladimir Sementsov-Ogievskiy
2015-06-24  0:21     ` John Snow
2015-07-08 12:24       ` Vladimir Sementsov-Ogievskiy
2015-07-08 15:21         ` John Snow
2015-08-27 10:08       ` Vladimir Sementsov-Ogievskiy
  -- strict thread matches above, loose matches on Subject: below --
2015-01-13 17:02 [Qemu-devel] [PATCH 0/8] block: persistent dirty bitmaps (RFC) Vladimir Sementsov-Ogievskiy
2015-01-13 17:02 ` [Qemu-devel] [PATCH 1/8] spec: add qcow2-dirty-bitmaps specification Vladimir Sementsov-Ogievskiy
2015-01-27 15:39   ` Eric Blake

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=5577FA11.3080009@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@parallels.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).