diff mbox series

[RFC,09/12] qapi/block-core: add BitmapMapping and BitmapEntry structs

Message ID 20180512012537.22478-10-jsnow@redhat.com
State New
Headers show
Series qemu-img: add bitmap queries | expand

Commit Message

John Snow May 12, 2018, 1:25 a.m. UTC
Add two new structures for detailing the marked regions of bitmaps as
saved in e.g. qcow2 files.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 qapi/block-core.json | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Eric Blake May 16, 2018, 9:37 p.m. UTC | #1
On 05/11/2018 08:25 PM, John Snow wrote:
> Add two new structures for detailing the marked regions of bitmaps as
> saved in e.g. qcow2 files.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   qapi/block-core.json | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 8f33f41ce7..de8ad73a78 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -298,6 +298,38 @@
>              'zero': 'bool', 'depth': 'int', '*offset': 'int',
>              '*filename': 'str' } }
>   
> +##
> +# @BitmapEntry:
> +#
> +# Dirty Bitmap region information for a virtual block range
> +#
> +# @offset: the start byte of the dirty virtual range
> +#
> +# @length: the number of bytes of the dirty virtual range
> +#
> +# Since: 2.13
> +#
> +##
> +{ 'struct': 'BitmapEntry',
> +  'data': { 'offset': 'int', 'length': 'int' } }
> +
> +##
> +# @BitmapMapping:
> +#
> +# List of described regions correlated to a named bitmap.
> +#
> +# @name: The name of the bitmap whose range is described here
> +#
> +# @entries: A list of zero or more @BitmapEntry elements representing
> +#           the range(s) described by the bitmap.

Is it also worth documenting that the list will be in ascending order, 
with no overlaps (no two entries covering the same offset); and in fact 
with a gap between all entries (as otherwise those two consecutive 
entries could have been consolidated to one)?

> +#
> +# Since: 2.13
> +#
> +##
> +{ 'struct': 'BitmapMapping',
> +  'data': { 'name': 'str',
> +            'entries': [ 'BitmapEntry' ] } }
> +
>   ##
>   # @BlockdevCacheInfo:
>   #
>
John Snow May 16, 2018, 9:55 p.m. UTC | #2
On 05/16/2018 05:37 PM, Eric Blake wrote:
>> +##
>> +# @BitmapMapping:
>> +#
>> +# List of described regions correlated to a named bitmap.
>> +#
>> +# @name: The name of the bitmap whose range is described here
>> +#
>> +# @entries: A list of zero or more @BitmapEntry elements representing
>> +#           the range(s) described by the bitmap.
> 
> Is it also worth documenting that the list will be in ascending order,
> with no overlaps (no two entries covering the same offset); and in fact
> with a gap between all entries (as otherwise those two consecutive
> entries could have been consolidated to one)?
> 

Hm. I didn't necessarily want to guarantee the order, but being more
specific about the output will assist legibility of the spec.

I'll amend the documentation and make some stronger guarantees.

>> +#
>> +# Since: 2.13
>> +#
>> +##
>> +{ 'struct': 'BitmapMapping',
>> +  'data': { 'name': 'str',
>> +            'entries': [ 'BitmapEntry' ] } }
>> +
>>   ##
>>   # @BlockdevCacheInfo:
>>   #
diff mbox series

Patch

diff --git a/qapi/block-core.json b/qapi/block-core.json
index 8f33f41ce7..de8ad73a78 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -298,6 +298,38 @@ 
            'zero': 'bool', 'depth': 'int', '*offset': 'int',
            '*filename': 'str' } }
 
+##
+# @BitmapEntry:
+#
+# Dirty Bitmap region information for a virtual block range
+#
+# @offset: the start byte of the dirty virtual range
+#
+# @length: the number of bytes of the dirty virtual range
+#
+# Since: 2.13
+#
+##
+{ 'struct': 'BitmapEntry',
+  'data': { 'offset': 'int', 'length': 'int' } }
+
+##
+# @BitmapMapping:
+#
+# List of described regions correlated to a named bitmap.
+#
+# @name: The name of the bitmap whose range is described here
+#
+# @entries: A list of zero or more @BitmapEntry elements representing
+#           the range(s) described by the bitmap.
+#
+# Since: 2.13
+#
+##
+{ 'struct': 'BitmapMapping',
+  'data': { 'name': 'str',
+            'entries': [ 'BitmapEntry' ] } }
+
 ##
 # @BlockdevCacheInfo:
 #