qcow2: persistent dirty bitmaps
v8 cover qcow2: persistent dirty bitmaps
Hi all!
Here is a new update of qcow2-bitmap series.
Max, Eric, great tanks for your review!
I hope, I've covered most of your comments by this update.
v8
web: https://src.openvz.org/users/vsementsov/repos/qemu/browse?at=qcow2-bitmap-v8
git: https://src.openvz.org/scm/~vsementsov/qemu.git (tag qcow2-bitmap-v8) based on Max's block branch: https://github.com/XanClic/qemu/commits/block
changes v7->v8:
Patches 01-06 are mostly unchanged, except for spelling and wording. 02 - add Eric's r-b
03,04 - add Max's r-b
07-09 is refactored "bitmap-read" part of the feature. Main changes:
- introduce bitmap list - normal list, which represents bitmap directory. Function bitmap_list_load loads bitmap directory, checks everything and creates normal list.
- introduce .bdrv_load_autoloading_dirty_bitmaps : instead of loading bitmaps in qcow2_open, lets load them only in bdrv_open, to avoid reloading in bdrv_snapshot_goto
- do not delete bitmaps after read, but mark them IN_USE
10 has contextual changes and rewording of comment. I've added Max's r-b, hope it's ok.
11: add error_report("Persistent bitmaps are lost") in case of failed bitmap store
12: add Max's r-b
13 is refactored "bitmap-store" part of the feature. see 07-09 description
- for now I just free old clusters and allocate new. This will be improved with a separate patch.
patch about "delete bitmaps on truncate" is removed. This case will be handled later. IN_USE, autoclear, check-constraints things are merged into other patches.
14-15 are mew patches, to early check possibility of creating persistent bitmap with
specified name and granularity in specified BDS
16-17: spelling, rewording, indenting, tiny code simplifying, check can_store (by 14-15),
s/if (autoload && !persistent)/if (has_autoload && !persistent)/, rebase (deleted qmp-commands.hx)
18: alternative to md5 in query-block:
- separated qmp command -x-debug-block-dirty-bitmap-sha256
- as adviced by Daniel P. Berrange in my parallel thread:
- sha256 instead of md5
- use qcrypto_hash_* instead of GChecksum
- fix bug =) (size was wrong in hbitmap_md5)
19: s/3999/3fff/, use x-debug-block-dirty-bitmap-sha256
20: new patch to rename and publish inc_refcounts
21: some fixes and refactoring mostyly by Max's comments.
TODO:
- handle reopening image RO->RW and incoming migration, set IN_USE for existing loaded bitmaps in these cases.
- reuse old, already allocated data clusters for bitmaps storing
- truncate bitmaps in the image on truncate
v7:
https://src.openvz.org/users/vsementsov/repos/qemu/browse?at=refs%2Ftags%2Fqcow2-bitmap-v7
based on block-next (https://github.com/XanClic/qemu/commits/block-next)
- a lot of refactoring and reordering of patches.
- dead code removed (bdrv_dirty_bitmap_load, etc.)
- do not maintain extra data for now
- do not store dirty bitmap directory in memory (as we use it seldom, we can just reread if needed)
By Kevin's review:
01 - commit message changed: fix->improvement (as it was not a bug) 03 - r-b
04 - r-b
05 - add 21 patch to fix spec, also, removed all (I hope) mentions of
"Bitmap Header", switch to one unified name for it - "Bitmap Directory Entry", to avoid misunderstanding with Qcow2 header. (also, add patch 22, to fix it in spec)
v6.06 - improve for_each_dir_entry loop, reorder patches, other small fixes v6.07 ~> v7.09 - dead code removed, I've moved to one function
.bdrv_store_persistent_bitmaps and have wrapper and callback in one patch (with also some other staff. If it not ok, I can split them)
v6.08 - about keeping bitmap directory instead of bitmap list: no I don't keep
it at all.
v6.16 - old bdrv_ bitmap-storing related functions are removed. The new one is
bdrv_store_persistent_bitmaps.
v6:
https://src.openvz.org/users/vsementsov/repos/qemu/browse?at=refs%2Ftags%2Fqcow2-bitmap-v6
based on block-next (https://github.com/XanClic/qemu/commits/block-next)
There are a lot of changes, reorderings and additions in comparement with v5. One principal thing: now bitmaps are removed from image after loading instead of marking them in_use. It is simpler and we do not need to store superfluous data. Also, we are no more interested in command line interface to dirty bitmaps. So it is dropped. If someone needs it I can add it later.
Vladimir Sementsov-Ogievskiy (21):
specs/qcow2: fix bitmap granularity qemu-specific note specs/qcow2: do not use wording 'bitmap header'
hbitmap: improve dirty iter
tests: add hbitmap iter test
block: fix bdrv_dirty_bitmap_granularity signature block/dirty-bitmap: add deserialize_ones func
qcow2: add dirty bitmaps extension
block: introduce auto-loading bitmaps
qcow2: add .bdrv_load_autoloading_dirty_bitmaps block/dirty-bitmap: add autoload field to BdrvDirtyBitmap
block: introduce persistent dirty bitmaps block/dirty-bitmap: add bdrv_dirty_bitmap_next()
qcow2: add .bdrv_store_persistent_dirty_bitmaps()
block: add bdrv_can_store_dirty_bitmap
qcow2: add .bdrv_can_store_dirty_bitmap
qmp: add persistent flag to block-dirty-bitmap-add
qmp: add autoload parameter to block-dirty-bitmap-add
qmp: add x-debug-block-dirty-bitmap-sha256
iotests: test qcow2 persistent dirty bitmap
qcow2-refcount: rename inc_refcounts() and make it public
qcow2-bitmap: refcounts
block.c | 67 +++ block/Makefile.objs | 2 +- block/dirty-bitmap.c | 63 ++- block/qcow2-bitmap.c | 1229 ++++++++++++++++++++++++++++++++++++++++++ block/qcow2-refcount.c | 59 +- block/qcow2.c | 105 +++- block/qcow2.h | 39 ++ blockdev.c | 64 ++- docs/qmp-commands.txt | 7 + docs/specs/qcow2.txt | 8 +- include/block/block.h | 5 + include/block/block_int.h | 7 + include/block/dirty-bitmap.h | 18 +- include/qemu/hbitmap.h | 48 +- qapi/block-core.json | 37 +- tests/qemu-iotests/165 | 89 +++ tests/qemu-iotests/165.out | 5 + tests/qemu-iotests/group | 1 + tests/test-hbitmap.c | 19 + util/hbitmap.c | 51 +- 20 files changed, 1863 insertions(+), 60 deletions(-) create mode 100644 block/qcow2-bitmap.c create mode 100755 tests/qemu-iotests/165 create mode 100644 tests/qemu-iotests/165.out
Signature · 1 line
1.8.3.1
PATCH v8 1/21 specs/qcow2: fix bitmap granularity qemu-specific note
--- docs/specs/qcow2.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
docs/specs/qcow2.txt +1 -2
@@ -472,8 +472,7 @@ Structure of a bitmap directory entry: 17: granularity_bits Granularity bits. Valid values: 0 - 63. - Note: Qemu currently doesn't support granularity_bits - greater than 31. + Note: Qemu currently supports only values 9 - 31. Granularity is calculated as granularity = 1 << granularity_bits
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 01/21] specs/qcow2: fix bitmap granularity qemu-specific note
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- docs/specs/qcow2.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)docs/specs/qcow2.txt +0
-0
docs/specs/qcow2.txt Structure of a bitmap directory entry: · line 478
Quoted 9 lines
docs/specs/qcow2.txt +1
-2@@ -472,8 +472,7 @@ Structure of a bitmap directory entry: 17: granularity_bits Granularity bits. Valid values: 0 - 63. - Note: Qemu currently doesn't support granularity_bits - greater than 31. + Note: Qemu currently supports only values 9 - 31. Granularity is calculated as granularity = 1 << granularity_bits
PATCH v8 2/21 specs/qcow2: do not use wording 'bitmap header'
In reply to Vladimir Sementsov-OgievskiyA bitmap directory entry is sometimes called a 'bitmap header'. This patch leaves only one name - 'bitmap directory entry'. The name 'bitmap header' creates misunderstandings with 'qcow2 header' and 'qcow2 bitmap header extension' (which is extension of qcow2 header)
--- docs/specs/qcow2.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
docs/specs/qcow2.txt +2 -3
@@ -201,7 +201,7 @@ The fields of the bitmaps extension are: 8 - 15: bitmap_directory_size Size of the bitmap directory in bytes. It is the cumulative - size of all (nb_bitmaps) bitmap headers. + size of all (nb_bitmaps) bitmap directory entries. 16 - 23: bitmap_directory_offset Offset into the image file at which the bitmap directory
@@ -426,8 +426,7 @@ Each bitmap saved in the image is described in a bitmap directory entry. The bitmap directory is a contiguous area in the image file, whose starting offset and length are given by the header extension fields bitmap_directory_offset and bitmap_directory_size. The entries of the bitmap directory have variable -length, depending on the lengths of the bitmap name and extra data. These -entries are also called bitmap headers. +length, depending on the lengths of the bitmap name and extra data. Structure of a bitmap directory entry:
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 02/21] specs/qcow2: do not use wording 'bitmap header'
Quoted 26 lines · Vladimir Sementsov-Ogievskiy
A bitmap directory entry is sometimes called a 'bitmap header'. This patch leaves only one name - 'bitmap directory entry'. The name 'bitmap header' creates misunderstandings with 'qcow2 header' and 'qcow2 bitmap header extension' (which is extension of qcow2 header)
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Reviewed-by Eric Blake <[email protected]>--- docs/specs/qcow2.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)docs/specs/qcow2.txt +1
-1@@ -201,7 +201,7 @@ The fields of the bitmaps extension are: 8 - 15: bitmap_directory_size Size of the bitmap directory in bytes. It is the cumulative - size of all (nb_bitmaps) bitmap headers. + size of all (nb_bitmaps) bitmap directory entries. 16 - 23: bitmap_directory_offset Offset into the image file at which the bitmap directory
docs/specs/qcow2.txt Each bitmap saved in the image is described in a bitmap directory entry. The · line 432
Quoted 9 lines
docs/specs/qcow2.txt +1
-2@@ -426,8 +426,7 @@ Each bitmap saved in the image is described in a bitmap directory entry. The bitmap directory is a contiguous area in the image file, whose starting offset and length are given by the header extension fields bitmap_directory_offset and bitmap_directory_size. The entries of the bitmap directory have variable -length, depending on the lengths of the bitmap name and extra data. These -entries are also called bitmap headers. +length, depending on the lengths of the bitmap name and extra data. Structure of a bitmap directory entry:
Great improvement.
PATCH v8 3/21 hbitmap: improve dirty iter
In reply to Vladimir Sementsov-OgievskiyMake dirty iter resistant to resetting bits in corresponding HBitmap.
--- include/qemu/hbitmap.h | 25 +++---------------------- util/hbitmap.c | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 23 deletions(-)
include/qemu/hbitmap.h +3 -22
@@ -243,10 +243,8 @@ void hbitmap_free(HBitmap *hb);* the lowest-numbered bit that is set in @hb, starting at @first. * * Concurrent setting of bits is acceptable, and will at worst cause the -* iteration to miss some of those bits. Resetting bits before the current -* position of the iterator is also okay. However, concurrent resetting of -* bits can lead to unexpected behavior if the iterator has not yet reached -* those bits. +* iteration to miss some of those bits. Concurrent resetting of bits is OK, +* too. */ void hbitmap_iter_init (HBitmapIter *hbi,const HBitmap *hb,uint64_t first);
@@ -285,24 +283,7 @@ void hbitmap_free_meta(HBitmap *hb);* Return the next bit that is set in @hbi's associated HBitmap, * or -1 if all remaining bits are zero. */ -static inline int64_t hbitmap_iter_next (HBitmapIter *hbi) -{ -unsigned long cur = hbi->cur[HBITMAP_LEVELS -1 ]; -int64_t item; - -if (cur ==0 ) { - cur =hbitmap_iter_skip_words (hbi); -if (cur ==0 ) { -return -1 ; - } - } - -/* The next call will resume work from the next bit. */ - hbi->cur[HBITMAP_LEVELS -1 ] = cur & (cur -1 ); - item = ((uint64_t )hbi->pos <<BITS_PER_LEVEL ) +ctzl (cur); - -return item << hbi->granularity; -} +int64_t hbitmap_iter_next (HBitmapIter *hbi);/** * hbitmap_iter_next_word:
util/hbitmap.c +22 -1
@@ -106,8 +106,9 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)unsigned long cur;do { - cur = hbi->cur[--i]; + i--; pos >>=BITS_PER_LEVEL ; + cur = hbi->cur[i] & hb->levels[i][pos]; }while (cur ==0 );/* Check for end of iteration. We always use fewer than BITS_PER_LONG
@@ -139,6 +140,26 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)return cur; } +int64_t hbitmap_iter_next (HBitmapIter *hbi) +{ +unsigned long cur = hbi->cur[HBITMAP_LEVELS -1 ] & + hbi->hb->levels[HBITMAP_LEVELS -1 ][hbi->pos]; +int64_t item; + +if (cur ==0 ) { + cur =hbitmap_iter_skip_words (hbi); +if (cur ==0 ) { +return -1 ; + } + } + +/* The next call will resume work from the next bit. */ + hbi->cur[HBITMAP_LEVELS -1 ] = cur & (cur -1 ); + item = ((uint64_t )hbi->pos <<BITS_PER_LEVEL ) +ctzl (cur); + +return item << hbi->granularity; +} +void hbitmap_iter_init (HBitmapIter *hbi,const HBitmap *hb,uint64_t first) {unsigned i, bit;
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 03/21] hbitmap: improve dirty iter
Quoted 14 lines · Vladimir Sementsov-Ogievskiy
Make dirty iter resistant to resetting bits in corresponding HBitmap.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Reviewed-by Max Reitz <[email protected]>--- include/qemu/hbitmap.h | 25 +++---------------------- util/hbitmap.c | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 23 deletions(-)include/qemu/hbitmap.h +0
-0
include/qemu/hbitmap.h void hbitmap_free(HBitmap *hb); · line 248
Quoted 10 lines
include/qemu/hbitmap.h +2
-4@@ -243,10 +243,8 @@ void hbitmap_free(HBitmap *hb);* the lowest-numbered bit that is set in @hb, starting at @first. * * Concurrent setting of bits is acceptable, and will at worst cause the -* iteration to miss some of those bits. Resetting bits before the current -* position of the iterator is also okay. However, concurrent resetting of -* bits can lead to unexpected behavior if the iterator has not yet reached -* those bits. +* iteration to miss some of those bits. Concurrent resetting of bits is OK, +* too. */
Minor bikeshed: I might remove "too" because the concurrent resetting of bits is perfectly ok in /contrast/ to the concurrent setting of bits, which has undesirable side-effects.
I may simply strongly word this as:
"The concurrent resetting of bits is OK."
It's not worth a rewrite on its own.
Quoted 71 lines
include/qemu/hbitmap.h +1
-18void hbitmap_iter_init (HBitmapIter *hbi,const HBitmap *hb,uint64_t first);@@ -285,24 +283,7 @@ void hbitmap_free_meta(HBitmap *hb);* Return the next bit that is set in @hbi's associated HBitmap, * or -1 if all remaining bits are zero. */ -static inline int64_t hbitmap_iter_next (HBitmapIter *hbi) -{ -unsigned long cur = hbi->cur[HBITMAP_LEVELS -1 ]; -int64_t item; - -if (cur ==0 ) { - cur =hbitmap_iter_skip_words (hbi); -if (cur ==0 ) { -return -1 ; - } - } - -/* The next call will resume work from the next bit. */ - hbi->cur[HBITMAP_LEVELS -1 ] = cur & (cur -1 ); - item = ((uint64_t )hbi->pos <<BITS_PER_LEVEL ) +ctzl (cur); - -return item << hbi->granularity; -} +int64_t hbitmap_iter_next (HBitmapIter *hbi);/** * hbitmap_iter_next_word: util/hbitmap.c +22
-1@@ -106,8 +106,9 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)unsigned long cur;do { - cur = hbi->cur[--i]; + i--; pos >>=BITS_PER_LEVEL ; + cur = hbi->cur[i] & hb->levels[i][pos]; }while (cur ==0 );/* Check for end of iteration. We always use fewer than BITS_PER_LONG @@ -139,6 +140,26 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)return cur; } +int64_t hbitmap_iter_next (HBitmapIter *hbi) +{ +unsigned long cur = hbi->cur[HBITMAP_LEVELS -1 ] & + hbi->hb->levels[HBITMAP_LEVELS -1 ][hbi->pos]; +int64_t item; + +if (cur ==0 ) { + cur =hbitmap_iter_skip_words (hbi); +if (cur ==0 ) { +return -1 ; + } + } + +/* The next call will resume work from the next bit. */ + hbi->cur[HBITMAP_LEVELS -1 ] = cur & (cur -1 ); + item = ((uint64_t )hbi->pos <<BITS_PER_LEVEL ) +ctzl (cur); + +return item << hbi->granularity; +} +void hbitmap_iter_init (HBitmapIter *hbi,const HBitmap *hb,uint64_t first) {unsigned i, bit;
PATCH v8 4/21 tests: add hbitmap iter test
In reply to Vladimir Sementsov-OgievskiyTest that hbitmap iter is resistant to bitmap resetting.
--- tests/test-hbitmap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
tests/test-hbitmap.c +19 -0
@@ -898,6 +898,22 @@ static void hbitmap_test_add(const char *testpath, hbitmap_test_teardown); } +static void test_hbitmap_iter_and_reset (TestHBitmapData *data, +const void *unused) +{ +HBitmapIter hbi; + +hbitmap_test_init (data,L1 *2 ,0 ); +hbitmap_set (data->hb,0 , data->size); + +hbitmap_iter_init (&hbi, data->hb,BITS_PER_LONG -1 ); + +hbitmap_iter_next (&hbi); + +hbitmap_reset_all (data->hb); +hbitmap_iter_next (&hbi); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -955,6 +971,9 @@ int main(int argc, char **argv) test_hbitmap_serialize_part);hbitmap_test_add ("/hbitmap/serialize/zeroes" , test_hbitmap_serialize_zeroes); + +hbitmap_test_add ("/hbitmap/iter/iter_and_reset" , + test_hbitmap_iter_and_reset);g_test_run ();return 0 ;
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 04/21] tests: add hbitmap iter test
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Test that hbitmap iter is resistant to bitmap resetting.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Max Reitz <[email protected]>
Quoted 42 lines
--- tests/test-hbitmap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)tests/test-hbitmap.c +19
-0@@ -898,6 +898,22 @@ static void hbitmap_test_add(const char *testpath, hbitmap_test_teardown); } +static void test_hbitmap_iter_and_reset (TestHBitmapData *data, +const void *unused) +{ +HBitmapIter hbi; + +hbitmap_test_init (data,L1 *2 ,0 ); +hbitmap_set (data->hb,0 , data->size); + +hbitmap_iter_init (&hbi, data->hb,BITS_PER_LONG -1 ); + +hbitmap_iter_next (&hbi); + +hbitmap_reset_all (data->hb); +hbitmap_iter_next (&hbi); +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );@@ -955,6 +971,9 @@ int main(int argc, char **argv) test_hbitmap_serialize_part);hbitmap_test_add ("/hbitmap/serialize/zeroes" , test_hbitmap_serialize_zeroes); + +hbitmap_test_add ("/hbitmap/iter/iter_and_reset" , + test_hbitmap_iter_and_reset);g_test_run ();return 0 ;
Signature · 1 line
—js
PATCH v8 5/21 block: fix bdrv_dirty_bitmap_granularity signature
In reply to Vladimir Sementsov-OgievskiyMake getter signature const-correct. This allows other functions with const dirty bitmap parameter use bdrv_dirty_bitmap_granularity().
--- block/dirty-bitmap.c | 2 +- include/block/dirty-bitmap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
block/dirty-bitmap.c +1 -1
@@ -388,7 +388,7 @@ uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs)return granularity; } -uint32_t bdrv_dirty_bitmap_granularity (BdrvDirtyBitmap *bitmap) +uint32_t bdrv_dirty_bitmap_granularity (const BdrvDirtyBitmap *bitmap) {return BDRV_SECTOR_SIZE <<hbitmap_granularity (bitmap->bitmap); }
include/block/dirty-bitmap.h +1 -1
@@ -29,7 +29,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);void bdrv_enable_dirty_bitmap (BdrvDirtyBitmap *bitmap);BlockDirtyInfoList *bdrv_query_dirty_bitmaps (BlockDriverState *bs);uint32_t bdrv_get_default_bitmap_granularity (BlockDriverState *bs); -uint32_t bdrv_dirty_bitmap_granularity (BdrvDirtyBitmap *bitmap); +uint32_t bdrv_dirty_bitmap_granularity (const BdrvDirtyBitmap *bitmap);uint32_t bdrv_dirty_bitmap_meta_granularity (BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_enabled (BdrvDirtyBitmap *bitmap);bool bdrv_dirty_bitmap_frozen (BdrvDirtyBitmap *bitmap);
Signature · 1 line
1.8.3.1
PATCH v8 6/21 block/dirty-bitmap: add deserialize_ones func
In reply to Vladimir Sementsov-OgievskiyAdd bdrv_dirty_bitmap_deserialize_ones() function, which is needed for qcow2 bitmap loading, to handle unallocated bitmap parts, marked as all-ones.
--- block/dirty-bitmap.c | 7 +++++++ include/block/dirty-bitmap.h | 3 +++ include/qemu/hbitmap.h | 15 +++++++++++++++ util/hbitmap.c | 17 +++++++++++++++++ 4 files changed, 42 insertions(+)
block/dirty-bitmap.c +7 -0
@@ -499,6 +499,13 @@ void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap,hbitmap_deserialize_zeroes (bitmap->bitmap, start, count, finish); } +void bdrv_dirty_bitmap_deserialize_ones (BdrvDirtyBitmap *bitmap, +uint64_t start,uint64_t count, +bool finish) +{ +hbitmap_deserialize_ones (bitmap->bitmap, start, count, finish); +} +void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap) {hbitmap_deserialize_finish (bitmap->bitmap);
include/block/dirty-bitmap.h +3 -0
@@ -70,6 +70,9 @@ void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap,void bdrv_dirty_bitmap_deserialize_zeroes (BdrvDirtyBitmap *bitmap,uint64_t start,uint64_t count,bool finish); +void bdrv_dirty_bitmap_deserialize_ones (BdrvDirtyBitmap *bitmap, +uint64_t start,uint64_t count, +bool finish);void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap);#endif
include/qemu/hbitmap.h +15 -0
@@ -216,6 +216,21 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint64_t start, uint64_t count, bool finish);/** +* hbitmap_deserialize_ones +* @hb: HBitmap to operate on. +* @start: First bit to restore. +* @count: Number of bits to restore. +* @finish: Whether to call hbitmap_deserialize_finish automatically. +* +* Fills the bitmap with ones. +* +* If @finish is false, caller must call hbitmap_serialize_finish before using +* the bitmap. +*/ +void hbitmap_deserialize_ones (HBitmap *hb,uint64_t start,uint64_t count, +bool finish); + +/** * hbitmap_deserialize_finish * @hb: HBitmap to operate on. *
util/hbitmap.c +17 -0
@@ -531,6 +531,23 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint64_t start, uint64_t count, } } +void hbitmap_deserialize_ones (HBitmap *hb,uint64_t start,uint64_t count, +bool finish) +{ +uint64_t el_count; +unsigned long *first; + +if (!count) { +return ; + } +serialization_chunk (hb, start, count, &first, &el_count); + +memset (first,0xff , el_count *sizeof (unsigned long )); +if (finish) { +hbitmap_deserialize_finish (hb); + } +} +void hbitmap_deserialize_finish (HBitmap *bitmap) {int64_t i, size, prev_size;
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 06/21] block/dirty-bitmap: add deserialize_ones func
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Add
bdrv_dirty_bitmap_deserialize_ones()function, which is needed for qcow2 bitmap loading, to handle unallocated bitmap parts, marked as all-ones.Reviewed-by Kevin Wolf <[email protected]>Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>
It's odd to have the S-o-B below the R-B, but likely not truly important.
Quoted 94 lines
--- block/dirty-bitmap.c | 7 +++++++ include/block/dirty-bitmap.h | 3 +++ include/qemu/hbitmap.h | 15 +++++++++++++++ util/hbitmap.c | 17 +++++++++++++++++ 4 files changed, 42 insertions(+)block/dirty-bitmap.c +7
-0@@ -499,6 +499,13 @@ void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap,hbitmap_deserialize_zeroes (bitmap->bitmap, start, count, finish); } +void bdrv_dirty_bitmap_deserialize_ones (BdrvDirtyBitmap *bitmap, +uint64_t start,uint64_t count, +bool finish) +{ +hbitmap_deserialize_ones (bitmap->bitmap, start, count, finish); +} +void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap) {hbitmap_deserialize_finish (bitmap->bitmap);include/block/dirty-bitmap.h +3
-0@@ -70,6 +70,9 @@ void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap,void bdrv_dirty_bitmap_deserialize_zeroes (BdrvDirtyBitmap *bitmap,uint64_t start,uint64_t count,bool finish); +void bdrv_dirty_bitmap_deserialize_ones (BdrvDirtyBitmap *bitmap, +uint64_t start,uint64_t count, +bool finish);void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap);#endif include/qemu/hbitmap.h +15
-0@@ -216,6 +216,21 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint64_t start, uint64_t count, bool finish);/** +* hbitmap_deserialize_ones +* @hb: HBitmap to operate on. +* @start: First bit to restore. +* @count: Number of bits to restore. +* @finish: Whether to call hbitmap_deserialize_finish automatically. +* +* Fills the bitmap with ones. +* +* If @finish is false, caller must call hbitmap_serialize_finish before using +* the bitmap. +*/ +void hbitmap_deserialize_ones (HBitmap *hb,uint64_t start,uint64_t count, +bool finish); + +/** * hbitmap_deserialize_finish * @hb: HBitmap to operate on. * util/hbitmap.c +17
-0@@ -531,6 +531,23 @@ void hbitmap_deserialize_zeroes(HBitmap *hb, uint64_t start, uint64_t count, } } +void hbitmap_deserialize_ones (HBitmap *hb,uint64_t start,uint64_t count, +bool finish) +{ +uint64_t el_count; +unsigned long *first; + +if (!count) { +return ; + } +serialization_chunk (hb, start, count, &first, &el_count); + +memset (first,0xff , el_count *sizeof (unsigned long )); +if (finish) { +hbitmap_deserialize_finish (hb); + } +} +void hbitmap_deserialize_finish (HBitmap *bitmap) {int64_t i, size, prev_size;
Signature · 1 line
—js
PATCH v8 7/21 qcow2: add dirty bitmaps extension
In reply to Vladimir Sementsov-OgievskiyAdd dirty bitmap extension as specified in docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.
For now, disable image resize if it has bitmaps. It will be fixed later.
--- block/qcow2.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- block/qcow2.h | 24 ++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-)
block/qcow2.c +99 -2
@@ -63,6 +63,7 @@ typedef struct {#define QCOW2_EXT_MAGIC_END 0#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA#define QCOW2_EXT_MAGIC_FEATURE_TABLE 0x6803f857 +#define QCOW2_EXT_MAGIC_DIRTY_BITMAPS 0x23852875static int qcow2_probe (const uint8_t *buf,int buf_size,const char *filename) {
@@ -92,6 +93,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,QCowExtension ext;uint64_t offset;int ret; +Qcow2BitmapHeaderExt bitmaps_ext;#ifdef DEBUG_EXT printf ("qcow2_read_extensions: start=%ld end=%ld\n" , start_offset, end_offset);
@@ -162,6 +164,75 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, }break ; +case QCOW2_EXT_MAGIC_DIRTY_BITMAPS : +if (ext.len !=sizeof (bitmaps_ext)) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Invalid extension length" ); +return -EINVAL ; + } + +if (!(s->autoclear_features &QCOW2_AUTOCLEAR_DIRTY_BITMAPS )) { +fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " +"set, all bitmaps will be considered as inconsistent" ); +break ; + } + + ret =bdrv_pread (bs->file, offset, &bitmaps_ext, ext.len); +if (ret <0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Could not read ext header" ); +return ret; + } + +if (bitmaps_ext.reserved32 !=0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Reserved field is not zero" ); +return -EINVAL ; + } + +be32_to_cpus (&bitmaps_ext.nb_bitmaps); +be64_to_cpus (&bitmaps_ext.bitmap_directory_size); +be64_to_cpus (&bitmaps_ext.bitmap_directory_offset); + +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" ); +return -EINVAL ; + } + +if (bitmaps_ext.nb_bitmaps ==0 ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"found bitmaps extension with zero bitmaps" ); +return -EINVAL ; + } + +if (bitmaps_ext.bitmap_directory_offset & (s->cluster_size -1 )) { +error_setg (errp,"ERROR: bitmaps_ext: " +"invalid dirty bitmap directory offset" ); +return -EINVAL ; + } + +if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } + + s->nb_bitmaps = bitmaps_ext.nb_bitmaps; + s->bitmap_directory_offset = + bitmaps_ext.bitmap_directory_offset; + s->bitmap_directory_size = + bitmaps_ext.bitmap_directory_size; + +#ifdef DEBUG_EXT +printf ("Qcow2: Got dirty bitmaps extension:" +" offset=%" PRIu64" nb_bitmaps=%" PRIu32"\n" , + s->bitmap_directory_offset, s->nb_bitmaps); +#endif +break ; +default :/* unknown magic - save it in case we need to rewrite the header */ {
@@ -1144,8 +1215,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, }/* Clear unknown autoclear feature bits */ -if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && s->autoclear_features) { - s->autoclear_features =0 ; +if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && + (s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK )) { + s->autoclear_features &=QCOW2_AUTOCLEAR_MASK ; ret =qcow2_update_header (bs);if (ret <0 ) {error_setg_errno (errp, -ret,"Could not update qcow2 header" );
@@ -1944,6 +2016,24 @@ int qcow2_update_header(BlockDriverState *bs) buflen -= ret; } +if (s->nb_bitmaps >0 ) { +Qcow2BitmapHeaderExt bitmaps_header = { + .nb_bitmaps =cpu_to_be32 (s->nb_bitmaps), + .bitmap_directory_size = +cpu_to_be64 (s->bitmap_directory_size), + .bitmap_directory_offset = +cpu_to_be64 (s->bitmap_directory_offset) + }; + ret =header_ext_add (buf,QCOW2_EXT_MAGIC_DIRTY_BITMAPS , + &bitmaps_header,sizeof (bitmaps_header), + buflen); +if (ret <0 ) { + goto fail; + } + buf += ret; + buflen -= ret; + } +/* Keep unknown header extensions */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret =header_ext_add (buf, uext->magic, uext->data, uext->len, buflen);
@@ -2514,6 +2604,13 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset)return -ENOTSUP ; } +/* cannot proceed if image has bitmaps */ +if (s->nb_bitmaps) { +/* TODO: resize bitmaps in the image */ +error_report ("Can't resize an image which has bitmaps" ); +return -ENOTSUP ; + } +/* shrinking is currently not supported */ if (offset < bs->total_sectors *512 ) {error_report ("qcow2 doesn't support shrinking images yet" );
block/qcow2.h +24 -0
@@ -52,6 +52,10 @@* space for snapshot names and IDs */ #define QCOW_MAX_SNAPSHOTS_SIZE (1024 * QCOW_MAX_SNAPSHOTS) +/* Bitmap header extension constraints */ +#define QCOW_MAX_DIRTY_BITMAPS 65535 +#define QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE (1024 * QCOW_MAX_DIRTY_BITMAPS) +/* indicate that the refcount of the referenced cluster is exactly one. */ #define QCOW_OFLAG_COPIED (1ULL << 63)/* indicate that the cluster is compressed (they never have the copied flag) */
@@ -195,6 +199,15 @@ enum { QCOW2_COMPAT_FEAT_MASK = QCOW2_COMPAT_LAZY_REFCOUNTS, }; +/* Autoclear feature bits */ +enum { +QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR =0 , +QCOW2_AUTOCLEAR_DIRTY_BITMAPS = +1 <<QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR , + +QCOW2_AUTOCLEAR_MASK =QCOW2_AUTOCLEAR_DIRTY_BITMAPS , +}; +enum qcow2_discard_type {QCOW2_DISCARD_NEVER =0 ,QCOW2_DISCARD_ALWAYS ,
@@ -222,6 +235,13 @@ typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array,typedef void Qcow2SetRefcountFunc (void *refcount_array,uint64_t index,uint64_t value); +typedef struct Qcow2BitmapHeaderExt { +uint32_t nb_bitmaps; +uint32_t reserved32; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +} QEMU_PACKED Qcow2BitmapHeaderExt; + typedef struct BDRVQcow2State { int cluster_bits; int cluster_size;
@@ -263,6 +283,10 @@ typedef struct BDRVQcow2State {unsigned int nb_snapshots;QCowSnapshot *snapshots; +uint32_t nb_bitmaps; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +int flags;int qcow_version;bool use_lazy_refcounts;
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 07/21] qcow2: add dirty bitmaps extension
Quoted 25 lines · Vladimir Sementsov-Ogievskiy
Add dirty bitmap extension as specified in
docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.For now, disable image resize if it has bitmaps. It will be fixed later.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/qcow2.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- block/qcow2.h | 24 ++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-)block/qcow2.c +1
-0@@ -63,6 +63,7 @@ typedef struct {#define QCOW2_EXT_MAGIC_END 0#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA#define QCOW2_EXT_MAGIC_FEATURE_TABLE 0x6803f857 +#define QCOW2_EXT_MAGIC_DIRTY_BITMAPS 0x23852875static int qcow2_probe (const uint8_t *buf,int buf_size,const char *filename) {
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 99
Quoted 7 lines
block/qcow2.c +1
-0@@ -92,6 +93,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,QCowExtension ext;uint64_t offset;int ret; +Qcow2BitmapHeaderExt bitmaps_ext;#ifdef DEBUG_EXT printf ("qcow2_read_extensions: start=%ld end=%ld\n" , start_offset, end_offset);
Unrelated, the comment at the top of qcow2_read_extensions is sorely lacking.
Quoted 8 lines
block/qcow2.c +4
-0@@ -162,6 +164,75 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, }break ; +case QCOW2_EXT_MAGIC_DIRTY_BITMAPS : +if (ext.len !=sizeof (bitmaps_ext)) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Invalid extension length" );
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 180
Quoted 10 lines
block/qcow2.c +10
-0+return -EINVAL ; + } + +if (!(s->autoclear_features &QCOW2_AUTOCLEAR_DIRTY_BITMAPS )) { +fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " +"set, all bitmaps will be considered as inconsistent" ); +break ; + } +
I might drop the "as" and just say "WARNING: bitmaps_ext: [the] autoclear flag is not set. All bitmaps will be considered inconsistent."
This may be a good place for Eric to check our English.
Quoted 10 lines
block/qcow2.c +10
-0+ ret =bdrv_pread (bs->file, offset, &bitmaps_ext, ext.len); +if (ret <0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Could not read ext header" ); +return ret; + } + +if (bitmaps_ext.reserved32 !=0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Reserved field is not zero" );
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 200
Quoted 10 lines
block/qcow2.c +10
-0+return -EINVAL ; + } + +be32_to_cpus (&bitmaps_ext.nb_bitmaps); +be64_to_cpus (&bitmaps_ext.bitmap_directory_size); +be64_to_cpus (&bitmaps_ext.bitmap_directory_offset); + +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" );
I might opt for something more like "File %s has %d bitmaps, exceeding the QEMU supported maximum of %d" to be a little more informative than "too many." (How many is too many? How many do we have?)
Quoted 5 lines
block/qcow2.c +5
-0+return -EINVAL ; + } + +if (bitmaps_ext.nb_bitmaps ==0 ) { + error_setg(errp, "ERROR: bitmaps_ext: "
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 215
Quoted 10 lines
block/qcow2.c +10
-0+ "found bitmaps extension with zero bitmaps"); +return -EINVAL ; + } + +if (bitmaps_ext.bitmap_directory_offset & (s->cluster_size -1 )) { +error_setg (errp,"ERROR: bitmaps_ext: " +"invalid dirty bitmap directory offset" ); +return -EINVAL ; + } +
Don't we have a helper for checking alignment? We've got "validate_table_offset." Can we use that?
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 222
Quoted 7 lines
block/qcow2.c +7
-0+if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } +
"Too large dirty bitmap" is an awkward phrasing, because it turns the entire message into a large compound noun.
I suggest working in a verb into the message, like "is" or "exceeds," here are some suggestions:
"[the] dirty bitmap directory size is too large" or "[the] dirty bitmap directory size (%zu) exceeds [the] maximum supported size (%zu)"
I can't decide if it's appropriate to include or exclude the article.
Luckily nobody else knows how English works either.
Quoted 54 lines
block/qcow2.c +34
-2+ s->nb_bitmaps = bitmaps_ext.nb_bitmaps; + s->bitmap_directory_offset = + bitmaps_ext.bitmap_directory_offset; + s->bitmap_directory_size = + bitmaps_ext.bitmap_directory_size; + +#ifdef DEBUG_EXT +printf ("Qcow2: Got dirty bitmaps extension:" +" offset=%" PRIu64" nb_bitmaps=%" PRIu32"\n" , + s->bitmap_directory_offset, s->nb_bitmaps); +#endif +break ; +default :/* unknown magic - save it in case we need to rewrite the header */ {@@ -1144,8 +1215,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, }/* Clear unknown autoclear feature bits */ -if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && s->autoclear_features) { - s->autoclear_features =0 ; +if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && + (s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK )) { + s->autoclear_features &=QCOW2_AUTOCLEAR_MASK ; ret =qcow2_update_header (bs);if (ret <0 ) {error_setg_errno (errp, -ret,"Could not update qcow2 header" );@@ -1944,6 +2016,24 @@ int qcow2_update_header(BlockDriverState *bs) buflen -= ret; } +if (s->nb_bitmaps >0 ) { +Qcow2BitmapHeaderExt bitmaps_header = { + .nb_bitmaps =cpu_to_be32 (s->nb_bitmaps), + .bitmap_directory_size = +cpu_to_be64 (s->bitmap_directory_size), + .bitmap_directory_offset = +cpu_to_be64 (s->bitmap_directory_offset) + }; + ret =header_ext_add (buf,QCOW2_EXT_MAGIC_DIRTY_BITMAPS , + &bitmaps_header,sizeof (bitmaps_header), + buflen); +if (ret <0 ) { + goto fail; + } + buf += ret; + buflen -= ret; + } +/* Keep unknown header extensions */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret =header_ext_add (buf, uext->magic, uext->data, uext->len, buflen);
block/qcow2.c static int qcow2_truncate(BlockDriverState *bs, int64_t offset) · line 2613
Quoted 10 lines
block/qcow2.c +7
-0@@ -2514,6 +2604,13 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset)return -ENOTSUP ; } +/* cannot proceed if image has bitmaps */ +if (s->nb_bitmaps) { +/* TODO: resize bitmaps in the image */ +error_report ("Can't resize an image which has bitmaps" ); +return -ENOTSUP ; + } +
I guess this is an open problem and not one we address in this series.
Quoted 8 lines
block/qcow2.c +0
-0/* shrinking is currently not supported */ if (offset < bs->total_sectors *512 ) {error_report ("qcow2 doesn't support shrinking images yet" );block/qcow2.h +0
-0
block/qcow2.h line 58
Quoted 7 lines
block/qcow2.h +4
-0@@ -52,6 +52,10 @@* space for snapshot names and IDs */ #define QCOW_MAX_SNAPSHOTS_SIZE (1024 * QCOW_MAX_SNAPSHOTS) +/* Bitmap header extension constraints */ +#define QCOW_MAX_DIRTY_BITMAPS 65535 +#define QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE (1024 * QCOW_MAX_DIRTY_BITMAPS) +
64MiB for just the headers seems like a really generous limit that we will never, ever, ever exhaust.
(I look forward to future versions of QEMU where this feedback item is laughed at playfully.)
Quoted 6 lines
block/qcow2.h +0
-0/* indicate that the refcount of the referenced cluster is exactly one. */ #define QCOW_OFLAG_COPIED (1ULL << 63)/* indicate that the cluster is compressed (they never have the copied flag) */ @@ -195,6 +199,15 @@ enum { QCOW2_COMPAT_FEAT_MASK = QCOW2_COMPAT_LAZY_REFCOUNTS, };
block/qcow2.h enum { · line 210
Quoted 10 lines
block/qcow2.h +9
-0+/* Autoclear feature bits */ +enum { +QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR =0 , +QCOW2_AUTOCLEAR_DIRTY_BITMAPS = +1 <<QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR , + +QCOW2_AUTOCLEAR_MASK =QCOW2_AUTOCLEAR_DIRTY_BITMAPS , +}; +
This seems like a strange construct to me -- the ranges for _BITNR and mask variants will begin colliding as soon as we add just one more constant to the list.
Enumerations do allow this, but I generally don't like using a single enumeration to describe more than one thing.
Do we really need the BITNR variants at all? Why not the following:
enum {
QCOW2_AUTOCLEAR_DIRTY_BITMAPS = 1 << 0,
};#define QCOW2_AUTOCLEAR_MASK QCOW2_AUTOCLEAR_DIRTY_BITMAPS
Quoted 19 lines
block/qcow2.h +7
-0enum qcow2_discard_type {QCOW2_DISCARD_NEVER =0 ,QCOW2_DISCARD_ALWAYS ,@@ -222,6 +235,13 @@ typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array,typedef void Qcow2SetRefcountFunc (void *refcount_array,uint64_t index,uint64_t value); +typedef struct Qcow2BitmapHeaderExt { +uint32_t nb_bitmaps; +uint32_t reserved32; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +} QEMU_PACKED Qcow2BitmapHeaderExt; + typedef struct BDRVQcow2State { int cluster_bits; int cluster_size;
block/qcow2.h typedef struct BDRVQcow2State { · line 292
Quoted 10 lines
block/qcow2.h +4
-0@@ -263,6 +283,10 @@ typedef struct BDRVQcow2State {unsigned int nb_snapshots;QCowSnapshot *snapshots; +uint32_t nb_bitmaps; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +int flags;int qcow_version;bool use_lazy_refcounts;
Only style issues from my POV...
Re: [Qemu-devel] [PATCH 07/21] qcow2: add dirty bitmaps extension
Quoted 22 lines · John Snow
Quoted 15 lines · Vladimir Sementsov-Ogievskiy
Add dirty bitmap extension as specified in
docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.For now, disable image resize if it has bitmaps. It will be fixed later.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>---
+ if (!(s->autoclear_features &
QCOW2_AUTOCLEAR_DIRTY_BITMAPS)) {block/qcow2.c +3
-0+fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " + "set, all bitmaps will be considered asinconsistent");
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 180
Quoted 3 lines
block/qcow2.c +3
-0+break ; + } +
Quoted 2 lines
I might drop the "as" and just say "WARNING:
bitmaps_ext: [the] autoclear flag is not set. All bitmaps will be considered inconsistent."
Even the 'bitmaps_ext:' prefix seems a bit redundant, since the rest of the message talks about bitmaps.
Quoted 3 lines
This may be a good place for Eric to check our English.
Maybe take the message from a different angle:
WARNING: all bitmaps are considered inconsistent since the autoclear flag was cleared
or
WARNING: the autoclear flag was cleared, so all bitmaps are considered inconsistent
or even skip the technical details, and report it with a longer message but while still sounding legible:
WARNING: a program lacking bitmap support modified this file, so all bitmaps are now considered inconsistent
Quoted 9 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 200
Quoted 4 lines
block/qcow2.c +4
-0+ +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" );I might opt for something more like "File %s has %d bitmaps, exceeding the QEMU supported maximum of %d" to be a little more informative than "too many." (How many is too many? How many do we have?)
The use of ERROR: in error_setg() seems over the top.
John's proposed wording is nice, here.
Quoted 7 lines
Quoted 7 lines
block/qcow2.c +6
-0+return -EINVAL ; + } + + if (bitmaps_ext.nb_bitmaps == 0) { + error_setg(errp, "ERROR: bitmaps_ext: " + "found bitmaps extension with zerobitmaps");
So why is it an error to have a bitmaps extension but no bitmaps allocated? Is that too strict?
Again, the ERROR: prefix is a bit much in error_setg().
Quoted 9 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 222
Quoted 8 lines
block/qcow2.c +7
-0+if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } +
Quoted 8 lines
"Too large dirty bitmap" is an awkward phrasing, because it turns the entire message into a large compound noun.
I suggest working in a verb into the message, like "is" or "exceeds," here are some suggestions:
"[the] dirty bitmap directory size is too large" or "[the] dirty bitmap directory size (%zu) exceeds [the] maximum supported size (%zu)"
The latter is the most informative.
Quoted 2 lines
I can't decide if it's appropriate to include or exclude the article.
Yep, choosing when to use articles is sometimes subjective.
the/blank sounds odd - it's the only combo I'd avoid blank/blank seems reasonable, and has the benefit of being short blank/the seems reasonable
the/the seems rather formal, but still works
Quoted 2 lines
Luckily nobody else knows how English works either.
What, there's rules to follow? :)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 07/21] qcow2: add dirty bitmaps extension
Quoted 72 lines · Eric Blake
Quoted 22 lines · John Snow
Quoted 15 lines · Vladimir Sementsov-Ogievskiy
Add dirty bitmap extension as specified in
docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.For now, disable image resize if it has bitmaps. It will be fixed later.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>---
+ if (!(s->autoclear_features &
QCOW2_AUTOCLEAR_DIRTY_BITMAPS)) {block/qcow2.c +3
-0+fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " + "set, all bitmaps will be considered asinconsistent");
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 180
Quoted 3 lines
block/qcow2.c +3
-0+break ; + } +Quoted 2 lines
I might drop the "as" and just say "WARNING:
bitmaps_ext: [the] autoclear flag is not set. All bitmaps will be considered inconsistent."Even the '
bitmaps_ext:' prefix seems a bit redundant, since the rest of the message talks about bitmaps.Quoted 3 lines
This may be a good place for Eric to check our English.
Maybe take the message from a different angle:
WARNING: all bitmaps are considered inconsistent since the autoclear flag was cleared
or
WARNING: the autoclear flag was cleared, so all bitmaps are considered inconsistent
or even skip the technical details, and report it with a longer message but while still sounding legible:
WARNING: a program lacking bitmap support modified this file, so all bitmaps are now considered inconsistent
Quoted 9 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 200
Quoted 4 lines
block/qcow2.c +4
-0+ +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" );I might opt for something more like "File %s has %d bitmaps, exceeding the QEMU supported maximum of %d" to be a little more informative than "too many." (How many is too many? How many do we have?)
The use of ERROR: in
error_setg()seems over the top.John's proposed wording is nice, here.
Quoted 7 lines
Quoted 7 lines
block/qcow2.c +6
-0+return -EINVAL ; + } + + if (bitmaps_ext.nb_bitmaps == 0) { + error_setg(errp, "ERROR: bitmaps_ext: " + "found bitmaps extension with zerobitmaps");
Quoted 5 lines
So why is it an error to have a bitmaps extension but no bitmaps allocated? Is that too strict?
Again, the ERROR: prefix is a bit much in
error_setg().
We wrote it that way in the spec:
````
The fields of the bitmaps extension are:
Byte 0 - 3: nb_bitmaps
The number of bitmaps contained in the image. Must be
greater than or equal to 1.
````So if we have no bitmaps, we must have no header.
Quoted 22 lines
Quoted 10 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 222
Quoted 9 lines
block/qcow2.c +7
-0+if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } +Quoted 8 lines
"Too large dirty bitmap" is an awkward phrasing, because it turns the entire message into a large compound noun.
I suggest working in a verb into the message, like "is" or "exceeds," here are some suggestions:
"[the] dirty bitmap directory size is too large" or "[the] dirty bitmap directory size (%zu) exceeds [the] maximum supported size (%zu)"
The latter is the most informative.
Quoted 1 line
Quoted 9 lines
Quoted 1 line
I can't decide if it's appropriate to include or exclude the article.
Yep, choosing when to use articles is sometimes subjective.
the/blank sounds odd - it's the only combo I'd avoid blank/blank seems reasonable, and has the benefit of being short blank/the seems reasonable
the/the seems rather formal, but still works
'Dirty bitmap directory size (%zu) exceeds the maximum supported size (%zu)' is probably my favorite upon review.
Quoted 5 lines
Quoted 2 lines
Luckily nobody else knows how English works either.
What, there's rules to follow? :)
Not that I am aware of. Thanks for the proofreading.
Signature · 1 line
—js
Re: [Qemu-devel] [PATCH 07/21] qcow2: add dirty bitmaps extension
In reply to John SnowQuoted 248 lines · John Snow
Quoted 34 lines · Vladimir Sementsov-Ogievskiy
Add dirty bitmap extension as specified in
docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.For now, disable image resize if it has bitmaps. It will be fixed later.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/qcow2.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- block/qcow2.h | 24 ++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-)block/qcow2.c +1
-0@@ -63,6 +63,7 @@ typedef struct {#define QCOW2_EXT_MAGIC_END 0#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA#define QCOW2_EXT_MAGIC_FEATURE_TABLE 0x6803f857 +#define QCOW2_EXT_MAGIC_DIRTY_BITMAPS 0x23852875static int qcow2_probe (const uint8_t *buf,int buf_size,const char *filename){
block/qcow2.c +1
-0@@ -92,6 +93,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, QCowExtension ext;uint64_t offset;int ret; +Qcow2BitmapHeaderExt bitmaps_ext;#ifdef DEBUG_EXT Quoted 2 lines
printf("qcow2_read_extensions: start=%ld end=%ld\n",
start_offset,end_offset);Unrelated, the comment at the top of
qcow2_read_extensionsis sorely lacking.Quoted 11 lines
block/qcow2.c +6
-0@@ -162,6 +164,75 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, }break ; +case QCOW2_EXT_MAGIC_DIRTY_BITMAPS : +if (ext.len !=sizeof (bitmaps_ext)) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Invalid extension length" ); +return -EINVAL ; + }block/qcow2.c static int · line 183
Quoted 10 lines
block/qcow2.c +8
-0+ +if (!(s->autoclear_features &QCOW2_AUTOCLEAR_DIRTY_BITMAPS )) { +fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " +"set, all bitmaps will be considered as inconsistent"); +break ; + } +I might drop the "as" and just say "WARNING:
bitmaps_ext: [the] autoclear flag is not set. All bitmaps will be considered inconsistent."This may be a good place for Eric to check our English.
Quoted 10 lines
block/qcow2.c +10
-0+ ret =bdrv_pread (bs->file, offset, &bitmaps_ext, ext.len); +if (ret <0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Could not read ext header" ); +return ret; + } + +if (bitmaps_ext.reserved32 !=0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Reserved field is not zero" );block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 200
Quoted 10 lines
block/qcow2.c +10
-0+return -EINVAL ; + } + +be32_to_cpus (&bitmaps_ext.nb_bitmaps); +be64_to_cpus (&bitmaps_ext.bitmap_directory_size); +be64_to_cpus (&bitmaps_ext.bitmap_directory_offset); + +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" );I might opt for something more like "File %s has %d bitmaps, exceeding the QEMU supported maximum of %d" to be a little more informative than "too many." (How many is too many? How many do we have?)
Quoted 15 lines
block/qcow2.c +6
-0+return -EINVAL ; + } + + if (bitmaps_ext.nb_bitmaps == 0) { + error_setg(errp, "ERROR: bitmaps_ext: " + "found bitmaps extension with zerobitmaps");
block/qcow2.c +4
-0+return -EINVAL ; + } + + if (bitmaps_ext.bitmap_directory_offset &(
s->cluster_size- 1)) {block/qcow2.c +2
-0+error_setg (errp,"ERROR: bitmaps_ext: " + "invalid dirty bitmap directoryoffset");
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 173
Quoted 3 lines
block/qcow2.c +3
-0+return -EINVAL ; + } +Don't we have a helper for checking alignment? We've got "
validate_table_offset." Can we use that?block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 222
Quoted 7 lines
block/qcow2.c +7
-0+if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } +"Too large dirty bitmap" is an awkward phrasing, because it turns the entire message into a large compound noun.
I suggest working in a verb into the message, like "is" or "exceeds," here are some suggestions:
"[the] dirty bitmap directory size is too large" or "[the] dirty bitmap directory size (%zu) exceeds [the] maximum supported size (%zu)"
I can't decide if it's appropriate to include or exclude the article.
Luckily nobody else knows how English works either.
Quoted 60 lines
block/qcow2.c +13
-0+ s->nb_bitmaps = bitmaps_ext.nb_bitmaps; + s->bitmap_directory_offset = + bitmaps_ext.bitmap_directory_offset; + s->bitmap_directory_size = + bitmaps_ext.bitmap_directory_size; + +#ifdef DEBUG_EXT +printf ("Qcow2: Got dirty bitmaps extension:" +" offset=%" PRIu64" nb_bitmaps=%" PRIu32"\n" , + s->bitmap_directory_offset, s->nb_bitmaps); +#endif +break ; +default :/* unknown magic - save it in case we need to rewrite the header */
{block/qcow2.c +3
-2@@ -1144,8 +1215,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, }/* Clear unknown autoclear feature bits */ -if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && s->autoclear_features) { - s->autoclear_features =0 ; + if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && + (s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK)) { + s->autoclear_features &= QCOW2_AUTOCLEAR_MASK; ret =qcow2_update_header (bs);if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2
header");block/qcow2.c +18
-0@@ -1944,6 +2016,24 @@ int qcow2_update_header(BlockDriverState *bs) buflen -= ret; } +if (s->nb_bitmaps >0 ) { +Qcow2BitmapHeaderExt bitmaps_header = { + .nb_bitmaps =cpu_to_be32 (s->nb_bitmaps), + .bitmap_directory_size = +cpu_to_be64 (s->bitmap_directory_size), + .bitmap_directory_offset = +cpu_to_be64 (s->bitmap_directory_offset) + }; + ret =header_ext_add (buf,QCOW2_EXT_MAGIC_DIRTY_BITMAPS , + &bitmaps_header,sizeof (bitmaps_header), + buflen); +if (ret <0 ) { + goto fail; + } + buf += ret; + buflen -= ret; + } +/* Keep unknown header extensions */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret = header_ext_add(buf, uext->magic, uext->data,
uext->len, buflen);block/qcow2.c +0
-0@@ -2514,6 +2604,13 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset)block/qcow2.c static int qcow2_truncate(BlockDriverState · line 2614
Quoted 10 lines
block/qcow2.c +7
-0return -ENOTSUP ; } +/* cannot proceed if image has bitmaps */ +if (s->nb_bitmaps) { +/* TODO: resize bitmaps in the image */ +error_report ("Can't resize an image which has bitmaps" ); +return -ENOTSUP ; + } +I guess this is an open problem and not one we address in this series.
Quoted 8 lines
block/qcow2.c +0
-0/* shrinking is currently not supported */ if (offset < bs->total_sectors *512 ) {error_report("qcow2 doesn't support shrinking images yet");block/qcow2.h +0
-0block/qcow2.h line 59
Quoted 8 lines
block/qcow2.h +4
-0@@ -52,6 +52,10 @@* space for snapshot names and IDs */ #define QCOW_MAX_SNAPSHOTS_SIZE (1024 * QCOW_MAX_SNAPSHOTS) +/* Bitmap header extension constraints */ +#define QCOW_MAX_DIRTY_BITMAPS 65535 +#define QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE (1024 * QCOW_MAX_DIRTY_BITMAPS) +64MiB for just the headers seems like a really generous limit that we will never, ever, ever exhaust.
(I look forward to future versions of QEMU where this feedback item is laughed at playfully.)
Quoted 9 lines
block/qcow2.h +0
-0/* indicate that the refcount of the referenced cluster is exactly one. */
#defineQCOW_OFLAG_COPIED(1ULL << 63)
/* indicate that the cluster is compressed (they never have the
copied flag) */block/qcow2.h +0
-0@@ -195,6 +199,15 @@ enum { QCOW2_COMPAT_FEAT_MASK = QCOW2_COMPAT_LAZY_REFCOUNTS, };block/qcow2.h enum { · line 211
Quoted 10 lines
block/qcow2.h +9
-0+/* Autoclear feature bits */ +enum { +QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR =0 , +QCOW2_AUTOCLEAR_DIRTY_BITMAPS = +1 <<QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR , + +QCOW2_AUTOCLEAR_MASK =QCOW2_AUTOCLEAR_DIRTY_BITMAPS , +}; +This seems like a strange construct to me -- the ranges for
_BITNRand mask variants will begin colliding as soon as we add just one more constant to the list.Enumerations do allow this, but I generally don't like using a single enumeration to describe more than one thing.
Quoted 7 lines
Do we really need the BITNR variants at all? Why not the following:
enum { QCOW2_AUTOCLEAR_DIRTY_BITMAPS = 1 << 0, };#define
QCOW2_AUTOCLEAR_MASKQCOW2_AUTOCLEAR_DIRTY_BITMAPS
I've just copied the same structure for 'Compatible feature bits'. And it was even already discussed). Anyway, this code should be refactored with separate patch, before or after these series.
Quoted 36 lines
Quoted 22 lines
block/qcow2.h +0
-0enum qcow2_discard_type {QCOW2_DISCARD_NEVER =0 ,
QCOW2_DISCARD_ALWAYS,block/qcow2.h +7
-0@@ -222,6 +235,13 @@ typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array, typedef void Qcow2SetRefcountFunc(void *refcount_array,uint64_t index,uint64_t value); +typedef struct Qcow2BitmapHeaderExt { +uint32_t nb_bitmaps; +uint32_t reserved32; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +} QEMU_PACKED Qcow2BitmapHeaderExt; + typedef struct BDRVQcow2State { int cluster_bits;int cluster_size;block/qcow2.h typedef struct BDRVQcow2State { · line 292
Quoted 10 lines
block/qcow2.h +4
-0@@ -263,6 +283,10 @@ typedef struct BDRVQcow2State {unsigned int nb_snapshots;QCowSnapshot *snapshots; +uint32_t nb_bitmaps; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +int flags;int qcow_version;bool use_lazy_refcounts;Only style issues from my POV...
Reviewed-by John Snow <[email protected]>
Signature · 2 lines
Best regards, Vladimir
Re: [Qemu-devel] [PATCH 07/21] qcow2: add dirty bitmaps extension
In reply to John SnowQuoted 103 lines · John Snow
Quoted 34 lines · Vladimir Sementsov-Ogievskiy
Add dirty bitmap extension as specified in
docs/specs/qcow2.txt. For now, just mirror extension header into Qcow2 state and check constraints.For now, disable image resize if it has bitmaps. It will be fixed later.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/qcow2.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- block/qcow2.h | 24 ++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-)block/qcow2.c +1
-0@@ -63,6 +63,7 @@ typedef struct {#define QCOW2_EXT_MAGIC_END 0#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA#define QCOW2_EXT_MAGIC_FEATURE_TABLE 0x6803f857 +#define QCOW2_EXT_MAGIC_DIRTY_BITMAPS 0x23852875static int qcow2_probe (const uint8_t *buf,int buf_size,const char *filename){
block/qcow2.c +1
-0@@ -92,6 +93,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, QCowExtension ext;uint64_t offset;int ret; +Qcow2BitmapHeaderExt bitmaps_ext;#ifdef DEBUG_EXT Quoted 2 lines
printf("qcow2_read_extensions: start=%ld end=%ld\n",
start_offset,end_offset);Unrelated, the comment at the top of
qcow2_read_extensionsis sorely lacking.Quoted 11 lines
block/qcow2.c +6
-0@@ -162,6 +164,75 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, }break ; +case QCOW2_EXT_MAGIC_DIRTY_BITMAPS : +if (ext.len !=sizeof (bitmaps_ext)) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Invalid extension length" ); +return -EINVAL ; + }block/qcow2.c static int · line 183
Quoted 10 lines
block/qcow2.c +8
-0+ +if (!(s->autoclear_features &QCOW2_AUTOCLEAR_DIRTY_BITMAPS )) { +fprintf (stderr, +"WARNING: bitmaps_ext: autoclear flag is not " +"set, all bitmaps will be considered as inconsistent"); +break ; + } +I might drop the "as" and just say "WARNING:
bitmaps_ext: [the] autoclear flag is not set. All bitmaps will be considered inconsistent."This may be a good place for Eric to check our English.
Quoted 10 lines
block/qcow2.c +10
-0+ ret =bdrv_pread (bs->file, offset, &bitmaps_ext, ext.len); +if (ret <0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Could not read ext header" ); +return ret; + } + +if (bitmaps_ext.reserved32 !=0 ) { +error_setg_errno (errp, -ret,"ERROR: bitmaps_ext: " +"Reserved field is not zero" );block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 200
Quoted 10 lines
block/qcow2.c +10
-0+return -EINVAL ; + } + +be32_to_cpus (&bitmaps_ext.nb_bitmaps); +be64_to_cpus (&bitmaps_ext.bitmap_directory_size); +be64_to_cpus (&bitmaps_ext.bitmap_directory_offset); + +if (bitmaps_ext.nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too many dirty bitmaps" );I might opt for something more like "File %s has %d bitmaps, exceeding the QEMU supported maximum of %d" to be a little more informative than "too many." (How many is too many? How many do we have?)
Quoted 12 lines
block/qcow2.c +6
-0+return -EINVAL ; + } + + if (bitmaps_ext.nb_bitmaps == 0) { + error_setg(errp, "ERROR: bitmaps_ext: " + "found bitmaps extension with zerobitmaps");
block/qcow2.c +4
-0+return -EINVAL ; + } + + if (bitmaps_ext.bitmap_directory_offset &(
s->cluster_size- 1)) {
Quoted 8 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 173
Quoted 6 lines
block/qcow2.c +2
-0+error_setg (errp,"ERROR: bitmaps_ext: " + "invalid dirty bitmap directoryoffset");
block/qcow2.c +3
-0+return -EINVAL ; + } +Don't we have a helper for checking alignment? We've got "
validate_table_offset." Can we use that?
function validate_table_offset() is strange, it actually validates not offset, but offset, size and entry-size.. It should be probably renamed to vailidate_table().. And I have no "entry size" for bitmap directory, as it's entries are of different sizes.
Quoted 180 lines
block/qcow2.c static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, · line 222
Quoted 8 lines
block/qcow2.c +7
-0+if (bitmaps_ext.bitmap_directory_size > +QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"ERROR: bitmaps_ext: " +"too large dirty bitmap directory" ); +return -EINVAL ; + } +"Too large dirty bitmap" is an awkward phrasing, because it turns the entire message into a large compound noun.
I suggest working in a verb into the message, like "is" or "exceeds," here are some suggestions:
"[the] dirty bitmap directory size is too large" or "[the] dirty bitmap directory size (%zu) exceeds [the] maximum supported size (%zu)"
I can't decide if it's appropriate to include or exclude the article.
Luckily nobody else knows how English works either.
Quoted 60 lines
block/qcow2.c +13
-0+ s->nb_bitmaps = bitmaps_ext.nb_bitmaps; + s->bitmap_directory_offset = + bitmaps_ext.bitmap_directory_offset; + s->bitmap_directory_size = + bitmaps_ext.bitmap_directory_size; + +#ifdef DEBUG_EXT +printf ("Qcow2: Got dirty bitmaps extension:" +" offset=%" PRIu64" nb_bitmaps=%" PRIu32"\n" , + s->bitmap_directory_offset, s->nb_bitmaps); +#endif +break ; +default :/* unknown magic - save it in case we need to rewrite the header */
{block/qcow2.c +3
-2@@ -1144,8 +1215,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, }/* Clear unknown autoclear feature bits */ -if (!bs->read_only && !(flags &BDRV_O_INACTIVE ) && s->autoclear_features) { - s->autoclear_features =0 ; + if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && + (s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK)) { + s->autoclear_features &= QCOW2_AUTOCLEAR_MASK; ret =qcow2_update_header (bs);if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2
header");block/qcow2.c +18
-0@@ -1944,6 +2016,24 @@ int qcow2_update_header(BlockDriverState *bs) buflen -= ret; } +if (s->nb_bitmaps >0 ) { +Qcow2BitmapHeaderExt bitmaps_header = { + .nb_bitmaps =cpu_to_be32 (s->nb_bitmaps), + .bitmap_directory_size = +cpu_to_be64 (s->bitmap_directory_size), + .bitmap_directory_offset = +cpu_to_be64 (s->bitmap_directory_offset) + }; + ret =header_ext_add (buf,QCOW2_EXT_MAGIC_DIRTY_BITMAPS , + &bitmaps_header,sizeof (bitmaps_header), + buflen); +if (ret <0 ) { + goto fail; + } + buf += ret; + buflen -= ret; + } +/* Keep unknown header extensions */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret = header_ext_add(buf, uext->magic, uext->data,
uext->len, buflen);block/qcow2.c +0
-0@@ -2514,6 +2604,13 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset)block/qcow2.c static int qcow2_truncate(BlockDriverState · line 2614
Quoted 10 lines
block/qcow2.c +7
-0return -ENOTSUP ; } +/* cannot proceed if image has bitmaps */ +if (s->nb_bitmaps) { +/* TODO: resize bitmaps in the image */ +error_report ("Can't resize an image which has bitmaps" ); +return -ENOTSUP ; + } +I guess this is an open problem and not one we address in this series.
Quoted 8 lines
block/qcow2.c +0
-0/* shrinking is currently not supported */ if (offset < bs->total_sectors *512 ) {error_report("qcow2 doesn't support shrinking images yet");block/qcow2.h +0
-0block/qcow2.h line 59
Quoted 8 lines
block/qcow2.h +4
-0@@ -52,6 +52,10 @@* space for snapshot names and IDs */ #define QCOW_MAX_SNAPSHOTS_SIZE (1024 * QCOW_MAX_SNAPSHOTS) +/* Bitmap header extension constraints */ +#define QCOW_MAX_DIRTY_BITMAPS 65535 +#define QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE (1024 * QCOW_MAX_DIRTY_BITMAPS) +64MiB for just the headers seems like a really generous limit that we will never, ever, ever exhaust.
(I look forward to future versions of QEMU where this feedback item is laughed at playfully.)
Quoted 9 lines
block/qcow2.h +0
-0/* indicate that the refcount of the referenced cluster is exactly one. */
#defineQCOW_OFLAG_COPIED(1ULL << 63)
/* indicate that the cluster is compressed (they never have the
copied flag) */block/qcow2.h +0
-0@@ -195,6 +199,15 @@ enum { QCOW2_COMPAT_FEAT_MASK = QCOW2_COMPAT_LAZY_REFCOUNTS, };block/qcow2.h enum { · line 211
Quoted 10 lines
block/qcow2.h +9
-0+/* Autoclear feature bits */ +enum { +QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR =0 , +QCOW2_AUTOCLEAR_DIRTY_BITMAPS = +1 <<QCOW2_AUTOCLEAR_DIRTY_BITMAPS_BITNR , + +QCOW2_AUTOCLEAR_MASK =QCOW2_AUTOCLEAR_DIRTY_BITMAPS , +}; +This seems like a strange construct to me -- the ranges for
_BITNRand mask variants will begin colliding as soon as we add just one more constant to the list.Enumerations do allow this, but I generally don't like using a single enumeration to describe more than one thing.
Do we really need the BITNR variants at all? Why not the following:
enum { QCOW2_AUTOCLEAR_DIRTY_BITMAPS = 1 << 0, };#define
QCOW2_AUTOCLEAR_MASKQCOW2_AUTOCLEAR_DIRTY_BITMAPSQuoted 20 lines
block/qcow2.h +0
-0enum qcow2_discard_type {QCOW2_DISCARD_NEVER =0 ,
QCOW2_DISCARD_ALWAYS,block/qcow2.h +7
-0@@ -222,6 +235,13 @@ typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array, typedef void Qcow2SetRefcountFunc(void *refcount_array,uint64_t index,uint64_t value); +typedef struct Qcow2BitmapHeaderExt { +uint32_t nb_bitmaps; +uint32_t reserved32; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +} QEMU_PACKED Qcow2BitmapHeaderExt; + typedef struct BDRVQcow2State { int cluster_bits;int cluster_size;block/qcow2.h typedef struct BDRVQcow2State { · line 292
Quoted 10 lines
block/qcow2.h +4
-0@@ -263,6 +283,10 @@ typedef struct BDRVQcow2State {unsigned int nb_snapshots;QCowSnapshot *snapshots; +uint32_t nb_bitmaps; +uint64_t bitmap_directory_size; +uint64_t bitmap_directory_offset; +int flags;int qcow_version;bool use_lazy_refcounts;Only style issues from my POV...
Reviewed-by John Snow <[email protected]>
Signature · 2 lines
Best regards, Vladimir
PATCH v8 8/21 block: introduce auto-loading bitmaps
In reply to Vladimir Sementsov-OgievskiyAuto loading bitmaps are bitmaps store in the disk image, which should be loaded when the image is opened and become BdrvDirtyBitmaps for the corresponding drive.
--- block.c | 14 ++++++++++++++ include/block/block.h | 2 ++ include/block/block_int.h | 3 +++ 3 files changed, 19 insertions(+)
block.c +14 -0
@@ -1137,6 +1137,13 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file, goto free_and_fail; } +bdrv_load_autoloading_dirty_bitmaps (bs, &local_err); +if (local_err) { +error_propagate (errp, local_err); + ret = -EINVAL ; + goto free_and_fail; + } +assert (bdrv_opt_mem_align (bs) !=0 );assert (bdrv_min_mem_align (bs) !=0 );assert (is_power_of_2 (bs->bl.request_alignment));
@@ -4091,3 +4098,10 @@ void bdrv_del_child(BlockDriverState *parent_bs, BdrvChild *child, Error **errp) parent_bs->drv->bdrv_del_child (parent_bs, child, errp); } + +void bdrv_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp) +{ +if (bs->drv && bs->drv->bdrv_load_autoloading_dirty_bitmaps) { + bs->drv->bdrv_load_autoloading_dirty_bitmaps (bs, errp); + } +}
include/block/block.h +2 -0
@@ -524,4 +524,6 @@ void bdrv_add_child(BlockDriverState *parent, BlockDriverState *child, Error **errp);void bdrv_del_child (BlockDriverState *parent,BdrvChild *child,Error **errp); +void bdrv_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp); +#endif
include/block/block_int.h +3 -0
@@ -322,6 +322,9 @@ struct BlockDriver {void (*bdrv_del_child)(BlockDriverState *parent,BdrvChild *child,Error **errp); +void (*bdrv_load_autoloading_dirty_bitmaps)(BlockDriverState *bs, +Error **errp); +QLIST_ENTRY (BlockDriver) list; };
Signature · 1 line
1.8.3.1
PATCH v8 9/21 qcow2: add .bdrv_load_autoloading_dirty_bitmaps
In reply to Vladimir Sementsov-OgievskiyAuto loading bitmaps are bitmaps in Qcow2, with the AUTO flag set. They are loaded when the image is opened and become BdrvDirtyBitmaps for the corresponding drive.
Extra data in bitmaps is not supported for now.
--- block/Makefile.objs | 2 +- block/qcow2-bitmap.c | 662 +++++++++++++++++++++++++++++++++++++++++++++++++++ block/qcow2.c | 2 + block/qcow2.h | 3 + 4 files changed, 668 insertions(+), 1 deletion(-) create mode 100644 block/qcow2-bitmap.c
block/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ block-obj-y += raw_bsd.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o -block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o +block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o block-obj-y += qed-check.o block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o
block/qcow2-bitmap.c new file +662 -0
662 lines not on this page · raw message
block/qcow2.c +2 -0
@@ -3507,6 +3507,8 @@ BlockDriver bdrv_qcow2 = { .bdrv_detach_aio_context = qcow2_detach_aio_context, .bdrv_attach_aio_context = qcow2_attach_aio_context, + + .bdrv_load_autoloading_dirty_bitmaps = qcow2_load_autoloading_dirty_bitmaps, };static void bdrv_qcow2_init (void )
block/qcow2.h +3 -0
@@ -615,4 +615,7 @@ int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset, void **table);void qcow2_cache_put (BlockDriverState *bs,Qcow2Cache *c,void **table); +/* qcow2-bitmap.c functions */ +void qcow2_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp); +#endif
Signature · 1 line
1.8.3.1
PATCH v8 10/21 block/dirty-bitmap: add autoload field to BdrvDirtyBitmap
In reply to Vladimir Sementsov-OgievskiyMirror AUTO flag from Qcow2 bitmap in BdrvDirtyBitmap. This will be needed in future, to save this flag back to Qcow2 for persistent bitmaps.
--- block/dirty-bitmap.c | 16 ++++++++++++++++ block/qcow2-bitmap.c | 2 ++ include/block/dirty-bitmap.h | 2 ++ 3 files changed, 20 insertions(+)
block/dirty-bitmap.c +16 -0
@@ -44,6 +44,8 @@ struct BdrvDirtyBitmap {int64_t size;/* Size of the bitmap (Number of sectors) */ bool disabled;/* Bitmap is read-only */ int active_iterators;/* How many iterators are active */ +bool autoload;/* For persistent bitmaps: bitmap must be +autoloaded on image opening */ QLIST_ENTRY (BdrvDirtyBitmap) list; };
@@ -70,6 +72,8 @@ void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap *bitmap)assert (!bdrv_dirty_bitmap_frozen (bitmap));g_free (bitmap->name); bitmap->name =NULL ; + + bitmap->autoload = false; } BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
@@ -238,6 +242,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs, bitmap->name =NULL ; successor->name = name; bitmap->successor =NULL ; + successor->autoload = bitmap->autoload; + bitmap->autoload = false;bdrv_release_dirty_bitmap (bs, bitmap);return successor;
@@ -540,3 +546,13 @@ int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap *bitmap) {return hbitmap_count (bitmap->meta); } + +void bdrv_dirty_bitmap_set_autoload (BdrvDirtyBitmap *bitmap,bool autoload) +{ + bitmap->autoload = autoload; +} + +bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap) +{ +return bitmap->autoload; +}
block/qcow2-bitmap.c +2 -0
@@ -633,6 +633,8 @@ void qcow2_load_autoloading_dirty_bitmaps(BlockDriverState *bs, Error **errp)if (bitmap ==NULL ) { goto fail; } + +bdrv_dirty_bitmap_set_autoload (bitmap, true); bm->flags |=BME_FLAG_IN_USE ; created_dirty_bitmaps =g_slist_append (created_dirty_bitmaps, bitmap);
include/block/dirty-bitmap.h +2 -0
@@ -75,4 +75,6 @@ void bdrv_dirty_bitmap_deserialize_ones(BdrvDirtyBitmap *bitmap, bool finish);void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap); +void bdrv_dirty_bitmap_set_autoload (BdrvDirtyBitmap *bitmap,bool autoload); +bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap);#endif
Signature · 1 line
1.8.3.1
PATCH v8 11/21 block: introduce persistent dirty bitmaps
In reply to Vladimir Sementsov-OgievskiyNew field BdrvDirtyBitmap.persistent means, that bitmap should be saved on bdrv_close, using format driver. Format driver should maintain bitmap storing.
--- block.c | 31 +++++++++++++++++++++++++++++++ block/dirty-bitmap.c | 26 ++++++++++++++++++++++++++ block/qcow2-bitmap.c | 1 + include/block/block.h | 1 + include/block/block_int.h | 2 ++ include/block/dirty-bitmap.h | 6 ++++++ 6 files changed, 67 insertions(+)
block.c +31 -0
@@ -2319,6 +2319,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)static void bdrv_close (BlockDriverState *bs) {BdrvAioNotifier *ban, *ban_next; +Error *local_err =NULL ;assert (!bs->job);assert (!bs->refcnt);
@@ -2327,6 +2328,11 @@ static void bdrv_close(BlockDriverState *bs)bdrv_flush (bs);bdrv_drain (bs);/* in case flush left pending I/O */ +bdrv_store_persistent_dirty_bitmaps (bs, &local_err); +if (local_err !=NULL ) { +error_report_err (local_err); +error_report ("Persistent bitmaps are lost" ); + }bdrv_release_named_dirty_bitmaps (bs);assert (QLIST_EMPTY (&bs->dirty_bitmaps));
@@ -4105,3 +4111,28 @@ void bdrv_load_autoloading_dirty_bitmaps(BlockDriverState *bs, Error **errp) bs->drv->bdrv_load_autoloading_dirty_bitmaps (bs, errp); } } + +void bdrv_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp) +{ +BlockDriver *drv = bs->drv; + +if (!bdrv_has_persistent_bitmaps (bs)) { +return ; + } + +if (!drv) { +error_setg_errno (errp,ENOMEDIUM , +"Can't store persistent bitmaps to %s" , +bdrv_get_device_or_node_name (bs)); +return ; + } + +if (!drv->bdrv_store_persistent_dirty_bitmaps) { +error_setg_errno (errp,ENOTSUP , +"Can't store persistent bitmaps to %s" , +bdrv_get_device_or_node_name (bs)); +return ; + } + + drv->bdrv_store_persistent_dirty_bitmaps (bs, errp); +}
block/dirty-bitmap.c +26 -0
@@ -44,6 +44,7 @@ struct BdrvDirtyBitmap {int64_t size;/* Size of the bitmap (Number of sectors) */ bool disabled;/* Bitmap is read-only */ int active_iterators;/* How many iterators are active */ +bool persistent;/* bitmap must be saved to owner disk image */ bool autoload;/* For persistent bitmaps: bitmap must be autoloaded on image opening */ QLIST_ENTRY (BdrvDirtyBitmap) list;
@@ -73,6 +74,7 @@ void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap *bitmap)g_free (bitmap->name); bitmap->name =NULL ; + bitmap->persistent = false; bitmap->autoload = false; }
@@ -242,6 +244,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs, bitmap->name =NULL ; successor->name = name; bitmap->successor =NULL ; + successor->persistent = bitmap->persistent; + bitmap->persistent = false; successor->autoload = bitmap->autoload; bitmap->autoload = false;bdrv_release_dirty_bitmap (bs, bitmap);
@@ -556,3 +560,25 @@ bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap *bitmap) {return bitmap->autoload; } + +void bdrv_dirty_bitmap_set_persistance (BdrvDirtyBitmap *bitmap,bool persistent) +{ + bitmap->persistent = persistent; +} + +bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap) +{ +return bitmap->persistent; +} + +bool bdrv_has_persistent_bitmaps (BlockDriverState *bs) +{ +BdrvDirtyBitmap *bm; + QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { +if (bm->persistent) { +return true; + } + } + +return false; +}
block/qcow2-bitmap.c +1 -0
@@ -634,6 +634,7 @@ void qcow2_load_autoloading_dirty_bitmaps(BlockDriverState *bs, Error **errp) goto fail; } +bdrv_dirty_bitmap_set_persistance (bitmap, true);bdrv_dirty_bitmap_set_autoload (bitmap, true); bm->flags |=BME_FLAG_IN_USE ; created_dirty_bitmaps =
include/block/block.h +1 -0
@@ -525,5 +525,6 @@ void bdrv_add_child(BlockDriverState *parent, BlockDriverState *child,void bdrv_del_child (BlockDriverState *parent,BdrvChild *child,Error **errp);void bdrv_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp); +void bdrv_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp);#endif
include/block/block_int.h +2 -0
@@ -324,6 +324,8 @@ struct BlockDriver {void (*bdrv_load_autoloading_dirty_bitmaps)(BlockDriverState *bs,Error **errp); +void (*bdrv_store_persistent_dirty_bitmaps)(BlockDriverState *bs, +Error **errp);QLIST_ENTRY (BlockDriver) list; };
include/block/dirty-bitmap.h +6 -0
@@ -77,4 +77,10 @@ void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);void bdrv_dirty_bitmap_set_autoload (BdrvDirtyBitmap *bitmap,bool autoload);bool bdrv_dirty_bitmap_get_autoload (const BdrvDirtyBitmap *bitmap); +void bdrv_dirty_bitmap_set_persistance (BdrvDirtyBitmap *bitmap, +bool persistent); +bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap); + +bool bdrv_has_persistent_bitmaps (BlockDriverState *bs); +#endif
Signature · 1 line
1.8.3.1
PATCH v8 12/21 block/dirty-bitmap: add bdrv_dirty_bitmap_next()
In reply to Vladimir Sementsov-Ogievskiy--- block/dirty-bitmap.c | 7 +++++++ include/block/dirty-bitmap.h | 3 +++ 2 files changed, 10 insertions(+)
block/dirty-bitmap.c +7 -0
@@ -582,3 +582,10 @@ bool bdrv_has_persistent_bitmaps(BlockDriverState *bs)return false; } + +BdrvDirtyBitmap *bdrv_dirty_bitmap_next (BlockDriverState *bs, +BdrvDirtyBitmap *bitmap) +{ +return bitmap ==NULL ?QLIST_FIRST (&bs->dirty_bitmaps) : +QLIST_NEXT (bitmap, list); +}
include/block/dirty-bitmap.h +3 -0
@@ -81,6 +81,9 @@ void bdrv_dirty_bitmap_set_persistance(BdrvDirtyBitmap *bitmap, bool persistent);bool bdrv_dirty_bitmap_get_persistance (BdrvDirtyBitmap *bitmap); +BdrvDirtyBitmap *bdrv_dirty_bitmap_next (BlockDriverState *bs, +BdrvDirtyBitmap *bitmap); +bool bdrv_has_persistent_bitmaps (BlockDriverState *bs);#endif
Signature · 1 line
1.8.3.1
PATCH v8 13/21 qcow2: add .bdrv_store_persistent_dirty_bitmaps()
In reply to Vladimir Sementsov-OgievskiyRealize block bitmap storing interface, to allow qcow2 images store persistent bitmaps.
--- block/qcow2-bitmap.c | 451 +++++++++++++++++++++++++++++++++++++++++++++++++++ block/qcow2.c | 1 + block/qcow2.h | 1 + 3 files changed, 453 insertions(+)
block/qcow2-bitmap.c +451 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "exec/log.h" +#include "qemu/cutils.h" #include "block/block_int.h" #include "block/qcow2.h"
@@ -43,6 +44,10 @@#define BME_MIN_GRANULARITY_BITS 9#define BME_MAX_NAME_SIZE 1023 +#if BME_MAX_TABLE_SIZE *8ULL >INT_MAX +#error In the code bitmap table physical size assumed to fit into int +#endif +/* Bitmap directory entry flags */ #define BME_RESERVED_FLAGS 0xfffffffcU#define BME_FLAG_IN_USE 1
@@ -74,6 +79,8 @@ typedef struct Qcow2Bitmap {uint8_t granularity_bits;char *name; +BdrvDirtyBitmap *dirty_bitmap; +QSIMPLEQ_ENTRY (Qcow2Bitmap) entry; } Qcow2Bitmap; typedef QSIMPLEQ_HEAD(Qcow2BitmapList, Qcow2Bitmap) Qcow2BitmapList;
@@ -87,6 +94,27 @@ static inline bool can_write(BlockDriverState *bs)return !bdrv_is_read_only (bs) && !(bdrv_get_flags (bs) &BDRV_O_INACTIVE ); } +static int update_header_sync (BlockDriverState *bs) +{ +int ret; + + ret =qcow2_update_header (bs); +if (ret <0 ) { +return ret; + } + +/* We doesn't return bdrv_flush error code. Even if it fails, write was +* successful and it is more logical to consider that header is in the new +* state than in the old. +*/ + ret =bdrv_flush (bs); +if (ret <0 ) { +fprintf (stderr,"Failed to flush qcow2 header" ); + } + +return 0 ; +} +static inline void bitmap_table_to_cpu (uint64_t *bitmap_table,size_t size) {size_t i;
@@ -96,6 +124,15 @@ static inline void bitmap_table_to_cpu(uint64_t *bitmap_table, size_t size) } } +static inline void bitmap_table_to_be (uint64_t *bitmap_table,size_t size) +{ +size_t i; + +for (i =0 ; i < size; ++i) { +cpu_to_be64s (&bitmap_table[i]); + } +} +/* Check table entry specification constraints. If cluster_size is 0, offset * alignment is not checked. */ static int check_table_entry (uint64_t entry,int cluster_size)
@@ -121,6 +158,51 @@ static int check_table_entry(uint64_t entry, int cluster_size)return 0 ; } +static int check_constraints_on_bitmap (BlockDriverState *bs, +const char *name, +uint32_t granularity) +{ +BDRVQcow2State *s = bs->opaque; +int granularity_bits =ctz32 (granularity); + +int64_t nb_sectors =bdrv_nb_sectors (bs); + +if (nb_sectors <0 ) { +return nb_sectors; + } + +uint64_t phys_bitmap_bytes = (nb_sectors <<BDRV_SECTOR_BITS ) >> + granularity_bits; +uint64_t bitmap_table_size = phys_bitmap_bytes / s->cluster_size; +size_t name_size =strlen (name); + +int fail = + (bitmap_table_size >BME_MAX_TABLE_SIZE ) || + (phys_bitmap_bytes >BME_MAX_PHYS_SIZE ) || + (granularity_bits >BME_MAX_GRANULARITY_BITS ) || + (granularity_bits <BME_MIN_GRANULARITY_BITS ) || + (name_size >BME_MAX_NAME_SIZE ); + +return fail ? -EINVAL :0 ; +} + +static void clear_bitmap_table (BlockDriverState *bs,uint64_t *bitmap_table, +uint32_t bitmap_table_size) +{ +BDRVQcow2State *s = bs->opaque; +int i; + +for (i =0 ; i < bitmap_table_size; ++i) { +uint64_t addr = bitmap_table[i] &BME_TABLE_ENTRY_OFFSET_MASK ; +if (!addr) { +continue ; + } + +qcow2_free_clusters (bs, addr, s->cluster_size,QCOW2_DISCARD_OTHER ); + bitmap_table[i] =0 ; + } +} +static int bitmap_table_load (BlockDriverState *bs,Qcow2Bitmap *bm,uint64_t **bitmap_table) {
@@ -159,6 +241,28 @@ fail:return ret; } +static int free_bitmap_clusters (BlockDriverState *bs,Qcow2Bitmap *bm) +{ +int ret; +uint64_t *bitmap_table; + + ret =bitmap_table_load (bs, bm, &bitmap_table); +if (ret <0 ) { +assert (bitmap_table ==NULL ); +return ret; + } + +clear_bitmap_table (bs, bitmap_table, bm->table_size); +qcow2_free_clusters (bs, bm->table_offset, bm->table_size *sizeof (uint64_t ), +QCOW2_DISCARD_OTHER ); +g_free (bitmap_table); + + bm->table_offset =0 ; + bm->table_size =0 ; + +return 0 ; +} +/* This function returns the number of disk sectors covered by a single cluster * of bitmap data. */ static uint64_t disk_sectors_in_bitmap_cluster(const BDRVQcow2State *s,
@@ -602,6 +706,72 @@ fail:* Bitmap List end */ +static int update_ext_header_and_dir (BlockDriverState *bs, +Qcow2BitmapList *bm_list) +{ +BDRVQcow2State *s = bs->opaque; +int ret; +Qcow2Bitmap *bm; +uint64_t new_offset =0 ; +uint64_t new_size =0 ; +uint32_t new_nb_bitmaps =0 ; +uint64_t old_offset = s->bitmap_directory_offset; +uint64_t old_size = s->bitmap_directory_size; +uint32_t old_nb_bitmaps = s->nb_bitmaps; +uint64_t old_autocl = s->autoclear_features; + +if (bm_list !=NULL && !QSIMPLEQ_EMPTY (bm_list)) { + QSIMPLEQ_FOREACH(bm, bm_list, entry) { + new_nb_bitmaps++; + } + +if (new_nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +return -EINVAL ; + } + + ret =bitmap_list_store (bs, bm_list, &new_offset, &new_size, false); +if (ret <0 ) { +return ret; + } + + ret =bdrv_flush (bs); +if (ret <0 ) { + goto fail; + } + + s->autoclear_features |=QCOW2_AUTOCLEAR_DIRTY_BITMAPS ; + }else { + s->autoclear_features &= ~(uint64_t )QCOW2_AUTOCLEAR_DIRTY_BITMAPS ; + } + + s->bitmap_directory_offset = new_offset; + s->bitmap_directory_size = new_size; + s->nb_bitmaps = new_nb_bitmaps; + + ret =update_header_sync (bs); +if (ret <0 ) { + goto fail; + } + +if (old_size >0 ) { +qcow2_free_clusters (bs, old_offset, old_size,QCOW2_DISCARD_OTHER ); + } + +return 0 ; + +fail: +if (new_offset >0 ) { +qcow2_free_clusters (bs, new_offset, new_size,QCOW2_DISCARD_OTHER ); + } + + s->bitmap_directory_offset = old_offset; + s->bitmap_directory_size = old_size; + s->nb_bitmaps = old_nb_bitmaps; + s->autoclear_features = old_autocl; + +return ret; +} +/* for g_slist_foreach for GSList of BdrvDirtyBitmap* elements */ static void release_dirty_bitmap_helper (gpointer bitmap,gpointer bs)
@@ -663,3 +833,284 @@ fail:g_slist_free (created_dirty_bitmaps);bitmap_list_free (bm_list); } + +/* store_bitmap_data() +* Store bitmap to image, filling bitmap table accordingly. +*/ +static uint64_t *store_bitmap_data (BlockDriverState *bs, +BdrvDirtyBitmap *bitmap, +uint32_t *bitmap_table_size,Error **errp) +{ +int ret; +BDRVQcow2State *s = bs->opaque; +int64_t sector; +uint64_t dsc; +uint64_t bm_size =bdrv_dirty_bitmap_size (bitmap); +const char *bm_name =bdrv_dirty_bitmap_name (bitmap); +uint8_t *buf =NULL ; +BdrvDirtyBitmapIter *dbi; +uint64_t *tb; +uint64_t tb_size = +size_to_clusters (s, +bdrv_dirty_bitmap_serialization_size (bitmap,0 , bm_size)); + +if (tb_size >BME_MAX_TABLE_SIZE || + tb_size * s->cluster_size >BME_MAX_PHYS_SIZE ) { +error_setg (errp,"Bitmap '%s' is too big" , bm_name); +return NULL ; + } + + tb =g_try_new0 (uint64_t, tb_size); +if (tb ==NULL ) { +error_setg (errp,"No memory" ); +return NULL ; + } + + dbi =bdrv_dirty_iter_new (bitmap,0 ); + buf =g_malloc (s->cluster_size); + dsc =disk_sectors_in_bitmap_cluster (s, bitmap); + +while ((sector =bdrv_dirty_iter_next (dbi)) !=-1 ) { +uint64_t cluster = sector / dsc; +uint64_t end, write_size; +int64_t off; + + sector = cluster * dsc; + end =MIN (bm_size, sector + dsc); + write_size = +bdrv_dirty_bitmap_serialization_size (bitmap, sector, end - sector); + + off =qcow2_alloc_clusters (bs, s->cluster_size); +if (off <0 ) { +error_setg_errno (errp, -off, +"Failed to allocate clusters for bitmap '%s'" , + bm_name); + goto fail; + } + tb[cluster] = off; + +bdrv_dirty_bitmap_serialize_part (bitmap, buf, sector, end - sector); +if (write_size < s->cluster_size) { +memset (buf + write_size,0 , s->cluster_size - write_size); + } + + ret =qcow2_pre_write_overlap_check (bs,0 , off, s->cluster_size); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Qcow2 overlap check failed" ); + goto fail; + } + + ret =bdrv_pwrite (bs->file, off, buf, s->cluster_size); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Failed to write bitmap '%s' to file" , + bm_name); + goto fail; + } + +if (end >= bm_size) { +break ; + } + +bdrv_set_dirty_iter (dbi, end); + } + + *bitmap_table_size = tb_size; +g_free (buf); +bdrv_dirty_iter_free (dbi); + +return tb; + +fail: +clear_bitmap_table (bs, tb, tb_size); +g_free (buf); +bdrv_dirty_iter_free (dbi); +g_free (tb); + +return NULL ; +} + +/* store_bitmap() +* Store bm->dirty_bitmap to qcow2. +* Set bm->table_offset and bm->table_size accordingly. +*/ +static int store_bitmap (BlockDriverState *bs,Qcow2Bitmap *bm,Error **errp) +{ +int ret; +uint64_t *tb; +int64_t tb_offset; +uint32_t tb_size; +BdrvDirtyBitmap *bitmap = bm->dirty_bitmap; +const char *bm_name; + +assert (bitmap !=NULL ); + + bm_name =bdrv_dirty_bitmap_name (bitmap); + + tb =store_bitmap_data (bs, bitmap, &tb_size, errp); +if (tb ==NULL ) { +g_free (tb); +return -EINVAL ; + } + +assert (tb_size <=BME_MAX_TABLE_SIZE ); + tb_offset =qcow2_alloc_clusters (bs, tb_size *sizeof (tb[0 ])); +if (tb_offset <0 ) { +error_setg_errno (errp, -tb_offset, +"Failed to allocate clusters for bitmap '%s'" , + bm_name); + goto fail; + } + + ret =qcow2_pre_write_overlap_check (bs,0 , tb_offset, + tb_size *sizeof (tb[0 ])); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Qcow2 overlap check failed" ); + goto fail; + } + +bitmap_table_to_be (tb, tb_size); + ret =bdrv_pwrite (bs->file, tb_offset, tb, tb_size *sizeof (tb[0 ])); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Failed to write bitmap '%s' to file" , + bm_name); + goto fail; + } + +g_free (tb); + + bm->table_offset = tb_offset; + bm->table_size = tb_size; + +return 0 ; + +fail: +clear_bitmap_table (bs, tb, tb_size); + +if (tb_offset >0 ) { +qcow2_free_clusters (bs, tb_offset, tb_size,QCOW2_DISCARD_OTHER ); + } + +g_free (tb); + +return ret; +} + +static Qcow2Bitmap *find_bitmap_by_name (Qcow2BitmapList *bm_list, +const char *name) +{ +Qcow2Bitmap *bm; + + QSIMPLEQ_FOREACH(bm, bm_list, entry) { +if (strcmp (name, bm->name) ==0 ) { +return bm; + } + } + +return NULL ; +} + +void qcow2_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp) +{ +BdrvDirtyBitmap *bitmap; +BDRVQcow2State *s = bs->opaque; +uint32_t new_nb_bitmaps = s->nb_bitmaps; +uint64_t new_dir_size = s->bitmap_directory_size; +int ret; +Qcow2BitmapList *bm_list; +Qcow2Bitmap *bm; + +if (!bdrv_has_persistent_bitmaps (bs)) { +/* nothing to do */ +return ; + } + +if (s->nb_bitmaps ==0 ) { + bm_list =bitmap_list_new (); + }else { + bm_list =bitmap_list_load (bs, s->bitmap_directory_offset, + s->bitmap_directory_size, errp); +if (bm_list ==NULL ) { +/* errp is already set */ +return ; + } + } + +/* check constraints and names */ +for (bitmap =bdrv_dirty_bitmap_next (bs,NULL ); bitmap !=NULL ; + bitmap =bdrv_dirty_bitmap_next (bs, bitmap)) { +const char *name =bdrv_dirty_bitmap_name (bitmap); +uint32_t granularity =bdrv_dirty_bitmap_granularity (bitmap); +Qcow2Bitmap *bm; + +if (!bdrv_dirty_bitmap_get_persistance (bitmap)) { +continue ; + } + +if (++new_nb_bitmaps >QCOW_MAX_DIRTY_BITMAPS ) { +error_setg (errp,"Too many persistent bitmaps" ); + goto fail; + } + + new_dir_size +=calc_dir_entry_size (strlen (name),0 ); +if (new_dir_size >QCOW_MAX_DIRTY_BITMAP_DIRECTORY_SIZE ) { +error_setg (errp,"Too large bitmap directory" ); + goto fail; + } + +if (check_constraints_on_bitmap (bs, name, granularity) <0 ) { +error_setg (errp,"Bitmap '%s' doesn't satisfy the constraints" , + name); + goto fail; + } + + bm =find_bitmap_by_name (bm_list, name); +if (bm ==NULL ) { + bm =g_new0 (Qcow2Bitmap,1 ); + bm->name =g_strdup (name); +QSIMPLEQ_INSERT_TAIL (bm_list, bm, entry); + }else { +if (!(bm->flags &BME_FLAG_IN_USE ) &&can_write (bs)) { +error_setg (errp,"Bitmap '%s' is already exists in the image" , + name); + goto fail; + } +free_bitmap_clusters (bs, bm); +/* TODO it is better to reuse these clusters */ + } + bm->flags =bdrv_dirty_bitmap_get_autoload (bitmap) ?BME_FLAG_AUTO :0 ; + bm->granularity_bits =ctz32 (bdrv_dirty_bitmap_granularity (bitmap)); + bm->dirty_bitmap = bitmap; + } + +/* allocate clusters and store bitmaps */ + QSIMPLEQ_FOREACH(bm, bm_list, entry) { +if (bm->dirty_bitmap ==NULL ) { +continue ; + } + + ret =store_bitmap (bs, bm, errp); +if (ret <0 ) { + goto fail; + } + } + + ret =update_ext_header_and_dir (bs, bm_list); +if (ret <0 ) { +error_setg_errno (errp, -ret,"Failed to update bitmap extension" ); + goto fail; + } + +bitmap_list_free (bm_list); +return ; + +fail: + QSIMPLEQ_FOREACH(bm, bm_list, entry) { +if (bm->dirty_bitmap ==NULL || bm->table_offset ==0 ) { +continue ; + } + +free_bitmap_clusters (bs, bm); + } + +bitmap_list_free (bm_list); +}
block/qcow2.c +1 -0
@@ -3509,6 +3509,7 @@ BlockDriver bdrv_qcow2 = { .bdrv_attach_aio_context = qcow2_attach_aio_context, .bdrv_load_autoloading_dirty_bitmaps = qcow2_load_autoloading_dirty_bitmaps, + .bdrv_store_persistent_dirty_bitmaps = qcow2_store_persistent_dirty_bitmaps, };static void bdrv_qcow2_init (void )
block/qcow2.h +1 -0
@@ -617,5 +617,6 @@ void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table);/* qcow2-bitmap.c functions */ void qcow2_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp); +void qcow2_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp);#endif
Signature · 1 line
1.8.3.1
PATCH v8 14/21 block: add bdrv_can_store_dirty_bitmap
In reply to Vladimir Sementsov-OgievskiyThis will be needed to check some restrictions before making bitmap persistent in qmp-block-dirty-bitmap-add (this functionality will be added by future patch)
--- block.c | 22 ++++++++++++++++++++++ include/block/block.h | 2 ++ include/block/block_int.h | 2 ++ 3 files changed, 26 insertions(+)
block.c +22 -0
@@ -4136,3 +4136,25 @@ void bdrv_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp) drv->bdrv_store_persistent_dirty_bitmaps (bs, errp); } + +bool bdrv_can_store_dirty_bitmap (BlockDriverState *bs,const char *name, +uint32_t granularity,Error **errp) +{ +BlockDriver *drv = bs->drv; + +if (!drv) { +error_setg_errno (errp,ENOMEDIUM , +"Can't store persistent bitmaps to %s" , +bdrv_get_device_or_node_name (bs)); +return false; + } + +if (!drv->bdrv_can_store_dirty_bitmap) { +error_setg_errno (errp,ENOTSUP , +"Can't store persistent bitmaps to %s" , +bdrv_get_device_or_node_name (bs)); +return false; + } + +return drv->bdrv_can_store_dirty_bitmap (bs, name, granularity, errp); +}
include/block/block.h +2 -0
@@ -526,5 +526,7 @@ void bdrv_del_child(BlockDriverState *parent, BdrvChild *child, Error **errp);void bdrv_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp);void bdrv_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp); +bool bdrv_can_store_dirty_bitmap (BlockDriverState *bs,const char *name, +uint32_t granularity,Error **errp);#endif
include/block/block_int.h +2 -0
@@ -326,6 +326,8 @@ struct BlockDriver { Error **errp);void (*bdrv_store_persistent_dirty_bitmaps)(BlockDriverState *bs,Error **errp); +bool (*bdrv_can_store_dirty_bitmap)(BlockDriverState *bs,const char *name, +uint32_t granularity,Error **errp);QLIST_ENTRY (BlockDriver) list; };
Signature · 1 line
1.8.3.1
PATCH v8 15/21 qcow2: add .bdrv_can_store_dirty_bitmap
In reply to Vladimir Sementsov-OgievskiyRealize .bdrv_can_store_dirty_bitmap interface.
--- block/qcow2-bitmap.c | 40 ++++++++++++++++++++++++++++++++++++++++ block/qcow2.c | 1 + block/qcow2.h | 4 ++++ 3 files changed, 45 insertions(+)
block/qcow2-bitmap.c +40 -0
@@ -1114,3 +1114,43 @@ fail:bitmap_list_free (bm_list); } + +bool qcow2_can_store_dirty_bitmap (BlockDriverState *bs, +const char *name, +uint32_t granularity, +Error **errp) +{ +BDRVQcow2State *s = bs->opaque; +const char *reason =NULL ; +bool found; +Qcow2BitmapList *bm_list; + +if (check_constraints_on_bitmap (bs, name, granularity) !=0 ) { + reason ="it doesn't satisfy the constraints" ; + goto common_errp; + } + +if (s->nb_bitmaps ==0 ) { +return true; + } + + bm_list =bitmap_list_load (bs, s->bitmap_directory_offset, + s->bitmap_directory_size, errp); +if (bm_list ==NULL ) { +return false; + } + + found = !!find_bitmap_by_name (bm_list, name); +bitmap_list_free (bm_list); +if (found) { + reason ="bitmap with the same name is already stored" ; + goto common_errp; + } + +return true; + +common_errp: +error_setg (errp,"Can't make bitmap '%s' persistent in '%s', as %s." , + name,bdrv_get_device_or_node_name (bs), reason); +return false; +}
block/qcow2.c +1 -0
@@ -3510,6 +3510,7 @@ BlockDriver bdrv_qcow2 = { .bdrv_load_autoloading_dirty_bitmaps = qcow2_load_autoloading_dirty_bitmaps, .bdrv_store_persistent_dirty_bitmaps = qcow2_store_persistent_dirty_bitmaps, + .bdrv_can_store_dirty_bitmap = qcow2_can_store_dirty_bitmap, };static void bdrv_qcow2_init (void )
block/qcow2.h +4 -0
@@ -618,5 +618,9 @@ void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table);/* qcow2-bitmap.c functions */ void qcow2_load_autoloading_dirty_bitmaps (BlockDriverState *bs,Error **errp);void qcow2_store_persistent_dirty_bitmaps (BlockDriverState *bs,Error **errp); +bool qcow2_can_store_dirty_bitmap (BlockDriverState *bs, +const char *name, +uint32_t granularity, +Error **errp);#endif
Signature · 1 line
1.8.3.1
PATCH v8 16/21 qmp: add persistent flag to block-dirty-bitmap-add
In reply to Vladimir Sementsov-OgievskiyAdd optional 'persistent' flag to qmp command block-dirty-bitmap-add. Default is false.
--- blockdev.c | 17 ++++++++++++++++- docs/qmp-commands.txt | 3 +++ qapi/block-core.json | 7 ++++++- 3 files changed, 25 insertions(+), 2 deletions(-)
blockdev.c +16 -1
@@ -1961,6 +1961,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState *common,/* AIO context taken and released within qmp_block_dirty_bitmap_add */ qmp_block_dirty_bitmap_add (action->node, action->name, action->has_granularity, action->granularity, + action->has_persistent, action->persistent, &local_err);if (!local_err) {
@@ -2688,10 +2689,12 @@ out:void qmp_block_dirty_bitmap_add (const char *node,const char *name,bool has_granularity,uint32_t granularity, +bool has_persistent,bool persistent,Error **errp) {AioContext *aio_context;BlockDriverState *bs; +BdrvDirtyBitmap *bitmap;if (!name || name[0 ] =='\0' ) {error_setg (errp,"Bitmap name cannot be empty" );
@@ -2717,7 +2720,19 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name, granularity =bdrv_get_default_bitmap_granularity (bs); } -bdrv_create_dirty_bitmap (bs, granularity, name, errp); +if (!has_persistent) { + persistent = false; + } + +if (persistent && + !bdrv_can_store_dirty_bitmap (bs, name, granularity, errp)) { + goto out; + } + + bitmap =bdrv_create_dirty_bitmap (bs, granularity, name, errp); +if (bitmap !=NULL ) { +bdrv_dirty_bitmap_set_persistance (bitmap, persistent); + } out:aio_context_release (aio_context);
docs/qmp-commands.txt +3 -0
@@ -1005,6 +1005,9 @@ Arguments: - "node": device/node on which to create dirty bitmap (json-string) - "name": name of the new dirty bitmap (json-string) - "granularity": granularity to track writes with (int, optional) +- "persistent": bitmap will be saved to the corresponding block device image + file on its close. For now only Qcow2 disks support persistent + bitmaps. (json-bool, optional, default false) (Since 2.8) Example:
qapi/block-core.json +6 -1
@@ -1231,10 +1231,15 @@ # @granularity: #optional the bitmap granularity, default is 64k for # block-dirty-bitmap-add # +# @persistent: #optional the bitmap is persistent, i.e. it will be saved to the +# corresponding block device image file on its close. Default is +# false. (Since 2.8) +# # Since 2.4 ## { 'struct': 'BlockDirtyBitmapAdd', - 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } } + 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32', + '*persistent': 'bool' } } ## # @block-dirty-bitmap-add
Signature · 1 line
1.8.3.1
PATCH v8 17/21 qmp: add autoload parameter to block-dirty-bitmap-add
In reply to Vladimir Sementsov-OgievskiyOptional. Default is false.
--- blockdev.c | 18 ++++++++++++++++-- docs/qmp-commands.txt | 4 ++++ qapi/block-core.json | 6 +++++- 3 files changed, 25 insertions(+), 3 deletions(-)
blockdev.c +16 -2
@@ -1962,6 +1962,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState *common,qmp_block_dirty_bitmap_add (action->node, action->name, action->has_granularity, action->granularity, action->has_persistent, action->persistent, + action->has_autoload, action->autoload, &local_err);if (!local_err) {
@@ -2690,6 +2691,7 @@ out:void qmp_block_dirty_bitmap_add (const char *node,const char *name,bool has_granularity,uint32_t granularity,bool has_persistent,bool persistent, +bool has_autoload,bool autoload,Error **errp) {AioContext *aio_context;
@@ -2723,6 +2725,15 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,if (!has_persistent) { persistent = false; } +if (!has_autoload) { + autoload = false; + } + +if (has_autoload && !persistent) { +error_setg (errp,"Autoload flag must be used only for persistent " +"bitmaps" ); + goto out; + }if (persistent && !bdrv_can_store_dirty_bitmap (bs, name, granularity, errp)) {
@@ -2730,10 +2741,13 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name, } bitmap =bdrv_create_dirty_bitmap (bs, granularity, name, errp); -if (bitmap !=NULL ) { -bdrv_dirty_bitmap_set_persistance (bitmap, persistent); +if (bitmap ==NULL ) { + goto out; } +bdrv_dirty_bitmap_set_persistance (bitmap, persistent); +bdrv_dirty_bitmap_set_autoload (bitmap, autoload); + out:aio_context_release (aio_context); }
docs/qmp-commands.txt +4 -0
@@ -1008,6 +1008,10 @@ Arguments: - "persistent": bitmap will be saved to the corresponding block device image file on its close. For now only Qcow2 disks support persistent bitmaps. (json-bool, optional, default false) (Since 2.8) +- "autoload": the bitmap will be automatically loaded when the image it is + stored in is opened. This flag may only be specified for + persistent bitmaps (json-bool, optional, default false) + (Since 2.8) Example:
qapi/block-core.json +5 -1
@@ -1235,11 +1235,15 @@ # corresponding block device image file on its close. Default is # false. (Since 2.8) # +# @autoload: #optional the bitmap will be automatically loaded when the image +# it is stored in is opened. This flag may only be specified for +# persistent bitmaps. Default is false. (Since 2.8) +# # Since 2.4 ## { 'struct': 'BlockDirtyBitmapAdd', 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32', - '*persistent': 'bool' } } + '*persistent': 'bool', '*autoload': 'bool' } } ## # @block-dirty-bitmap-add
Signature · 1 line
1.8.3.1
PATCH v8 18/21 qmp: add x-debug-block-dirty-bitmap-sha256
In reply to Vladimir Sementsov-Ogievskiy--- block/dirty-bitmap.c | 5 +++++ blockdev.c | 33 +++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 2 ++ include/qemu/hbitmap.h | 8 ++++++++ qapi/block-core.json | 26 ++++++++++++++++++++++++++ util/hbitmap.c | 11 +++++++++++ 6 files changed, 85 insertions(+)
block/dirty-bitmap.c +5 -0
@@ -589,3 +589,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,return bitmap ==NULL ?QLIST_FIRST (&bs->dirty_bitmaps) :QLIST_NEXT (bitmap, list); } + +char *bdrv_dirty_bitmap_sha256 (const BdrvDirtyBitmap *bitmap,Error **errp) +{ +return hbitmap_sha256 (bitmap->bitmap, errp); +}
blockdev.c +33 -0
@@ -2811,6 +2811,39 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,aio_context_release (aio_context); } +/** +* Completely clear a bitmap, for the purposes of synchronizing a bitmap +* immediately after a full backup operation. +*/ +BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256 (const char *node, +const char *name, +Error **errp) +{ +AioContext *aio_context; +BdrvDirtyBitmap *bitmap; +BlockDriverState *bs; +BlockDirtyBitmapSha256 *ret =NULL ; +char *sha256; + + bitmap =block_dirty_bitmap_lookup (node, name, &bs, &aio_context, errp); +if (!bitmap || !bs) { +return NULL ; + } + + sha256 =bdrv_dirty_bitmap_sha256 (bitmap, errp); +if (sha256 ==NULL ) { + goto out; + } + + ret =g_new (BlockDirtyBitmapSha256,1 ); + ret->sha256 = sha256; + +out: +aio_context_release (aio_context); + +return ret; +} +void hmp_drive_del (Monitor *mon,const QDict *qdict) {const char *id =qdict_get_str (qdict,"id" );
include/block/dirty-bitmap.h +2 -0
@@ -86,4 +86,6 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,bool bdrv_has_persistent_bitmaps (BlockDriverState *bs); +char *bdrv_dirty_bitmap_sha256 (const BdrvDirtyBitmap *bitmap,Error **errp); +#endif
include/qemu/hbitmap.h +8 -0
@@ -240,6 +240,14 @@ void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t count,void hbitmap_deserialize_finish (HBitmap *hb);/** +* hbitmap_sha256: +* @bitmap: HBitmap to operate on. +* +* Returns SHA256 hash of the last level. +*/ +char *hbitmap_sha256 (const HBitmap *bitmap,Error **errp); + +/** * hbitmap_free: * @hb: HBitmap to operate on. *
qapi/block-core.json +26 -0
@@ -1289,6 +1289,32 @@ 'data': 'BlockDirtyBitmap' } ## +# @BlockDirtyBitmapSha256: +# +# SHA256 hash of dirty bitmap data +# +# @sha256: bitmap SHA256 hash +# +# Since: 2.8 +## + { 'struct': 'BlockDirtyBitmapSha256', + 'data': {'sha256': 'str'} } + +## +# @x-debug-block-dirty-bitmap-sha256 +# +# Get bitmap SHA256 +# +# Returns: BlockDirtyBitmapSha256 on success +# If @node is not a valid block device, DeviceNotFound +# If @name is not found, GenericError with an explanation +# +# Since 2.8 +## + { 'command': 'x-debug-block-dirty-bitmap-sha256', + 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } + +## # @blockdev-mirror # # Start mirroring a block device's writes to a new destination.
util/hbitmap.c +11 -0
@@ -13,6 +13,7 @@#include "qemu/hbitmap.h" #include "qemu/host-utils.h" #include "trace.h" +#include "crypto/hash.h" /* HBitmaps provides an array of bits. The bits are stored as usual in an * array of unsigned longs, but HBitmap is also optimized to provide fast
@@ -707,3 +708,13 @@ void hbitmap_free_meta(HBitmap *hb)hbitmap_free (hb->meta); hb->meta =NULL ; } + +char *hbitmap_sha256 (const HBitmap *bitmap,Error **errp) +{ +size_t size = bitmap->sizes[HBITMAP_LEVELS -1 ] *sizeof (unsigned long ); +char *data = (char *)bitmap->levels[HBITMAP_LEVELS -1 ]; +char *hash =NULL ; +qcrypto_hash_digest (QCRYPTO_HASH_ALG_SHA256 , data, size, &hash, errp); + +return hash; +}
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 18/21] qmp: add x-debug-block-dirty-bitmap-sha256
Quoted 147 lines · Vladimir Sementsov-Ogievskiy
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/dirty-bitmap.c | 5 +++++ blockdev.c | 33 +++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 2 ++ include/qemu/hbitmap.h | 8 ++++++++ qapi/block-core.json | 26 ++++++++++++++++++++++++++ util/hbitmap.c | 11 +++++++++++ 6 files changed, 85 insertions(+)block/dirty-bitmap.c +5
-0@@ -589,3 +589,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,return bitmap ==NULL ?QLIST_FIRST (&bs->dirty_bitmaps) :QLIST_NEXT (bitmap, list); } + +char *bdrv_dirty_bitmap_sha256 (const BdrvDirtyBitmap *bitmap,Error **errp) +{ +return hbitmap_sha256 (bitmap->bitmap, errp); +}blockdev.c +33
-0@@ -2811,6 +2811,39 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,aio_context_release (aio_context); } +/** +* Completely clear a bitmap, for the purposes of synchronizing a bitmap +* immediately after a full backup operation. +*/ +BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256 (const char *node, +const char *name, +Error **errp) +{ +AioContext *aio_context; +BdrvDirtyBitmap *bitmap; +BlockDriverState *bs; +BlockDirtyBitmapSha256 *ret =NULL ; +char *sha256; + + bitmap =block_dirty_bitmap_lookup (node, name, &bs, &aio_context, errp); +if (!bitmap || !bs) { +return NULL ; + } + + sha256 =bdrv_dirty_bitmap_sha256 (bitmap, errp); +if (sha256 ==NULL ) { + goto out; + } + + ret =g_new (BlockDirtyBitmapSha256,1 ); + ret->sha256 = sha256; + +out: +aio_context_release (aio_context); + +return ret; +} +void hmp_drive_del (Monitor *mon,const QDict *qdict) {const char *id =qdict_get_str (qdict,"id" );include/block/dirty-bitmap.h +2
-0@@ -86,4 +86,6 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,bool bdrv_has_persistent_bitmaps (BlockDriverState *bs); +char *bdrv_dirty_bitmap_sha256 (const BdrvDirtyBitmap *bitmap,Error **errp); +#endif include/qemu/hbitmap.h +8
-0@@ -240,6 +240,14 @@ void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t count,void hbitmap_deserialize_finish (HBitmap *hb);/** +* hbitmap_sha256: +* @bitmap: HBitmap to operate on. +* +* Returns SHA256 hash of the last level. +*/ +char *hbitmap_sha256 (const HBitmap *bitmap,Error **errp); + +/** * hbitmap_free: * @hb: HBitmap to operate on. * qapi/block-core.json +26
-0@@ -1289,6 +1289,32 @@ 'data': 'BlockDirtyBitmap' } ## +# @BlockDirtyBitmapSha256: +# +# SHA256 hash of dirty bitmap data +# +# @sha256: bitmap SHA256 hash +# +# Since: 2.8 +## + { 'struct': 'BlockDirtyBitmapSha256', + 'data': {'sha256': 'str'} } + +## +# @x-debug-block-dirty-bitmap-sha256 +# +# Get bitmap SHA256 +# +# Returns: BlockDirtyBitmapSha256 on success +# If @node is not a valid block device, DeviceNotFound +# If @name is not found, GenericError with an explanation +# +# Since 2.8 +## + { 'command': 'x-debug-block-dirty-bitmap-sha256', + 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } + +## # @blockdev-mirror # # Start mirroring a block device's writes to a new destination.util/hbitmap.c +1
-0@@ -13,6 +13,7 @@#include "qemu/hbitmap.h" #include "qemu/host-utils.h" #include "trace.h" +#include "crypto/hash.h" /* HBitmaps provides an array of bits. The bits are stored as usual in an * array of unsigned longs, but HBitmap is also optimized to provide fast
util/hbitmap.c void hbitmap_free_meta(HBitmap *hb) · line 717
Quoted 10 lines
util/hbitmap.c +7
-0@@ -707,3 +708,13 @@ void hbitmap_free_meta(HBitmap *hb)hbitmap_free (hb->meta); hb->meta =NULL ; } + +char *hbitmap_sha256 (const HBitmap *bitmap,Error **errp) +{ +size_t size = bitmap->sizes[HBITMAP_LEVELS -1 ] *sizeof (unsigned long ); +char *data = (char *)bitmap->levels[HBITMAP_LEVELS -1 ]; +char *hash =NULL ; +qcrypto_hash_digest (QCRYPTO_HASH_ALG_SHA256 , data, size, &hash, errp);
By adding this here, you're adding a linking dependency to libqemuutil.a, which causes the test-hbitmap test to fail to link from this patch forward.
I'm not sure what the correct approach should be, but at a minimum we need to link crypto/hash.o to test/test-hbitmap.o to be able to run that test. We get build failures otherwise.
Quoted 4 lines
util/hbitmap.c +3
-0+ +return hash; +}
PATCH v8 19/21 iotests: test qcow2 persistent dirty bitmap
In reply to Vladimir Sementsov-Ogievskiy--- tests/qemu-iotests/165 | 89 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/165.out | 5 +++ tests/qemu-iotests/group | 1 + 3 files changed, 95 insertions(+) create mode 100755 tests/qemu-iotests/165 create mode 100644 tests/qemu-iotests/165.out
tests/qemu-iotests/165 new file +89 -0
@@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# Tests for persistent dirty bitmaps. +# +# Copyright: Vladimir Sementsov-Ogievskiy 2015-2016 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +import os +import iotests +from iotests import qemu_img + +disk = os.path.join(iotests.test_dir, 'disk') +disk_size = 0x40000000 # 1G + +# regions for qemu_io: (start, count) in bytes +regions1 = ((0, 0x100000), + (0x200000, 0x100000)) + +regions2 = ((0x10000000, 0x20000), + (0x3fff0000, 0x10000)) + +class TestPersistentDirtyBitmap(iotests.QMPTestCase): + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) + + def tearDown(self): + os.remove(disk) + + def mkVm(self): + return iotests.VM().add_drive(disk) + + def getSha256(self): + result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', + node='drive0', name='bitmap0') + return result['return']['sha256'] + + def checkBitmap(self, sha256): + result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', + node='drive0', name='bitmap0') + self.assert_qmp(result, 'return/sha256', sha256); + + def writeRegions(self, regions): + for r in regions: + self.vm.hmp_qemu_io('drive0', + 'write %d %d' % r) + + def qmpAddBitmap(self): + self.vm.qmp('block-dirty-bitmap-add', node='drive0', + name='bitmap0', persistent=True, autoload=True) + + def test_persistent(self): + self.vm = self.mkVm() + self.vm.launch() + self.qmpAddBitmap() + + self.writeRegions(regions1) + sha256 = self.getSha256() + + self.vm.shutdown() + self.vm = self.mkVm() + self.vm.launch() + + self.checkBitmap(sha256) + self.writeRegions(regions2) + sha256 = self.getSha256() + + self.vm.shutdown() + self.vm.launch() + + self.checkBitmap(sha256) + + self.vm.shutdown() + +if __name__ == '__main__': + iotests.main(supported_fmts=['qcow2'])
tests/qemu-iotests/165.out new file +5 -0
@@ -0,0 +1,5 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK
tests/qemu-iotests/group +1 -0
@@ -162,4 +162,5 @@ 159 rw auto quick 160 rw auto quick 162 auto quick +165 rw auto quick 170 rw auto quick
Signature · 1 line
1.8.3.1
PATCH v8 20/21 qcow2-refcount: rename inc_refcounts() and make it public
In reply to Vladimir Sementsov-OgievskiyThis is needed for the following patch, which will introduce refcounts checking for qcow2 bitmaps.
--- block/qcow2-refcount.c | 53 ++++++++++++++++++++++++++------------------------ block/qcow2.h | 4 ++++ 2 files changed, 32 insertions(+), 25 deletions(-)
block/qcow2-refcount.c +28 -25
@@ -1309,11 +1309,10 @@ static int realloc_refcount_array(BDRVQcow2State *s, void **array,* * Modifies the number of errors in res. */ -static int inc_refcounts (BlockDriverState *bs, -BdrvCheckResult *res, -void **refcount_table, -int64_t *refcount_table_size, -int64_t offset,int64_t size) +int qcow2_inc_refcounts_imrt (BlockDriverState *bs,BdrvCheckResult *res, +void **refcount_table, +int64_t *refcount_table_size, +int64_t offset,int64_t size) {BDRVQcow2State *s = bs->opaque;uint64_t start, last, cluster_offset, k, refcount;
@@ -1406,8 +1405,9 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) +1 ; l2_entry &= s->cluster_offset_mask; - ret =inc_refcounts (bs, res, refcount_table, refcount_table_size, - l2_entry & ~511 , nb_csectors *512 ); + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, refcount_table_size, + l2_entry & ~511 , nb_csectors *512 );if (ret <0 ) { goto fail; }
@@ -1445,8 +1445,9 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, }/* Mark cluster as used */ - ret =inc_refcounts (bs, res, refcount_table, refcount_table_size, - offset, s->cluster_size); + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, refcount_table_size, + offset, s->cluster_size);if (ret <0 ) { goto fail; }
@@ -1498,8 +1499,8 @@ static int check_refcounts_l1(BlockDriverState *bs, l1_size2 = l1_size *sizeof (uint64_t );/* Mark L1 table as used */ - ret =inc_refcounts (bs, res, refcount_table, refcount_table_size, - l1_table_offset, l1_size2); + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, refcount_table_size, + l1_table_offset, l1_size2);if (ret <0 ) { goto fail; }
@@ -1528,8 +1529,9 @@ static int check_refcounts_l1(BlockDriverState *bs,if (l2_offset) {/* Mark L2 table as used */ l2_offset &=L1E_OFFSET_MASK ; - ret =inc_refcounts (bs, res, refcount_table, refcount_table_size, - l2_offset, s->cluster_size); + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, refcount_table_size, + l2_offset, s->cluster_size);if (ret <0 ) { goto fail; }
@@ -1744,14 +1746,15 @@ static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, } res->corruptions_fixed++; - ret =inc_refcounts (bs, res, refcount_table, nb_clusters, - offset, s->cluster_size); + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, nb_clusters, + offset, s->cluster_size);if (ret <0 ) {return ret; }/* No need to check whether the refcount is now greater than 1: * This area was just allocated and zeroed, so it can only be -* exactly 1 after inc_refcounts() */ +* exactly 1 after qcow2_inc_refcounts_imrt() */ continue ; resize_fail:
@@ -1766,8 +1769,8 @@ resize_fail: }if (offset !=0 ) { - ret =inc_refcounts (bs, res, refcount_table, nb_clusters, - offset, s->cluster_size); + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, nb_clusters, + offset, s->cluster_size);if (ret <0 ) {return ret; }
@@ -1807,8 +1810,8 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, }/* header */ - ret =inc_refcounts (bs, res, refcount_table, nb_clusters, -0 , s->cluster_size); + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, nb_clusters, +0 , s->cluster_size);if (ret <0 ) {return ret; }
@@ -1829,16 +1832,16 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,return ret; } } - ret =inc_refcounts (bs, res, refcount_table, nb_clusters, - s->snapshots_offset, s->snapshots_size); + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, nb_clusters, + s->snapshots_offset, s->snapshots_size);if (ret <0 ) {return ret; }/* refcount data */ - ret =inc_refcounts (bs, res, refcount_table, nb_clusters, - s->refcount_table_offset, - s->refcount_table_size *sizeof (uint64_t )); + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, nb_clusters, + s->refcount_table_offset, + s->refcount_table_size *sizeof (uint64_t ));if (ret <0 ) {return ret; }
block/qcow2.h +4 -0
@@ -545,6 +545,10 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, int64_t size);int qcow2_pre_write_overlap_check (BlockDriverState *bs,int ign,int64_t offset,int64_t size); +int qcow2_inc_refcounts_imrt (BlockDriverState *bs,BdrvCheckResult *res, +void **refcount_table, +int64_t *refcount_table_size, +int64_t offset,int64_t size); int qcow2_change_refcount_order(BlockDriverState *bs, int refcount_order, BlockDriverAmendStatusCB *status_cb,
Signature · 1 line
1.8.3.1
PATCH v8 21/21 qcow2-bitmap: refcounts
In reply to Vladimir Sementsov-OgievskiyCalculate refcounts for qcow2 bitmaps. It is needed for qcow2's qemu-img check implementation.
--- block/qcow2-bitmap.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ block/qcow2-refcount.c | 6 +++++ block/qcow2.h | 3 +++ 3 files changed, 82 insertions(+)
block/qcow2-bitmap.c +73 -0
@@ -1154,3 +1154,76 @@ common_errp: name, bdrv_get_device_or_node_name(bs), reason);return false; } + +int qcow2_check_bitmaps_refcounts (BlockDriverState *bs,BdrvCheckResult *res, +void **refcount_table, +int64_t *refcount_table_size) +{ +int ret; +BDRVQcow2State *s = bs->opaque; +Qcow2BitmapList *bm_list; +Qcow2Bitmap *bm; + + ret =qcow2_inc_refcounts_imrt (bs, res, refcount_table, refcount_table_size, + s->bitmap_directory_offset, + s->bitmap_directory_size); +if (ret <0 ) { +return ret; + } + + bm_list =bitmap_list_load (bs, s->bitmap_directory_offset, + s->bitmap_directory_size,NULL ); +if (bm_list ==NULL ) { + res->corruptions++; +return -EINVAL ; + } + + QSIMPLEQ_FOREACH(bm, bm_list, entry) { +uint64_t *bitmap_table =NULL ; +int i; + + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, refcount_table_size, + bm->table_offset, + bm->table_size *sizeof (uint64_t )); +if (ret <0 ) { + goto out; + } + + ret =bitmap_table_load (bs, bm, &bitmap_table); +if (ret <0 ) { + res->corruptions++; + goto out; + } + +for (i =0 ; i < bm->table_size; ++i) { +uint64_t entry = bitmap_table[i]; +uint64_t offset = entry &BME_TABLE_ENTRY_OFFSET_MASK ; + +if (check_table_entry (entry, s->cluster_size) <0 ) { + res->corruptions++; + ret = -EINVAL ; +continue ; + } + +if (offset ==0 ) { +continue ; + } + + ret =qcow2_inc_refcounts_imrt (bs, res, + refcount_table, refcount_table_size, + offset, s->cluster_size); +if (ret <0 ) { +g_free (bitmap_table); + goto out; + } + } + +g_free (bitmap_table); + } + +out: +bitmap_list_free (bm_list); + +return ret; +}
block/qcow2-refcount.c +6 -0
@@ -1846,6 +1846,12 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,return ret; } +/* bitmaps */ + ret =qcow2_check_bitmaps_refcounts (bs, res, refcount_table, nb_clusters); +if (ret <0 ) { +return ret; + } +return check_refblocks (bs, res, fix, rebuild, refcount_table, nb_clusters); }
block/qcow2.h +3 -0
@@ -626,5 +626,8 @@ bool qcow2_can_store_dirty_bitmap(BlockDriverState *bs,const char *name, uint32_t granularity, Error **errp); +int qcow2_check_bitmaps_refcounts (BlockDriverState *bs,BdrvCheckResult *res, +void **refcount_table, +int64_t *refcount_table_size);#endif
Signature · 1 line
1.8.3.1
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Hi,
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Type: series
Subject: [Qemu-devel] [PATCH v8 00/21] qcow2: persistent dirty bitmaps
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=16
make docker-test-quick@centos6
make docker-test-mingw@fedora
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
d487933 qcow2-bitmap: refcounts
dfb3ae1 qcow2-refcount: rename inc_refcounts() and make it public 60f67ed iotests: test qcow2 persistent dirty bitmap 969c497 qmp: add x-debug-block-dirty-bitmap-sha256 b745f72 qmp: add autoload parameter to block-dirty-bitmap-add b1c5d9c qmp: add persistent flag to block-dirty-bitmap-add adb09d3 qcow2: add .bdrv_can_store_dirty_bitmap
bbfc424 block: add bdrv_can_store_dirty_bitmap
97d25c7 qcow2: add .bdrv_store_persistent_dirty_bitmaps() 5ecae31 block/dirty-bitmap: add bdrv_dirty_bitmap_next() f0a783f block: introduce persistent dirty bitmaps 7bebae9 block/dirty-bitmap: add autoload field to BdrvDirtyBitmap bbec81e qcow2: add .bdrv_load_autoloading_dirty_bitmaps b012705 block: introduce auto-loading bitmaps
f0b4d7c qcow2: add dirty bitmaps extension
a537b30 block/dirty-bitmap: add deserialize_ones func f8e9dba block: fix bdrv_dirty_bitmap_granularity signature e89fc7a tests: add hbitmap iter test
6448f2f hbitmap: improve dirty iter
1562a82 specs/qcow2: do not use wording 'bitmap header' fb7dfae specs/qcow2: fix bitmap granularity qemu-specific note
=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
BUILD centos6
make[1]: Entering directory `/var/tmp/patchew-tester-tmp-i0r8u2uq/src'
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-quick in qemu:centos6
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
ccache-3.1.6-2.el6.x86_64
epel-release-6-8.noarch
gcc-4.4.7-17.el6.x86_64
git-1.7.1-4.el6_7.1.x86_64
glib2-devel-2.28.8-5.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
make-3.81-23.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
tar-1.23-15.el6_8.x86_64
zlib-devel-1.2.3-29.el6.x86_64
Environment variables:
PACKAGES=libfdt-devel ccache tar git make gcc g++ zlib-devel glib2-devel SDL-devel pixman-devel epel-release
HOSTNAME=7293c0765ed2
TERM=xterm
MAKEFLAGS= -j16
HISTSIZE=1000
J=16
USER=root
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env
Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install No C++ compiler available; disabling C++ specific optional code
Install prefix /var/tmp/qemu-build/install BIOS directory /var/tmp/qemu-build/install/share/qemu binary directory /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib module directory /var/tmp/qemu-build/install/lib/qemu libexec directory /var/tmp/qemu-build/install/libexec include directory /var/tmp/qemu-build/install/include config directory /var/tmp/qemu-build/install/etc
local state directory /var/tmp/qemu-build/install/var
Manual directory /var/tmp/qemu-build/install/share/man ELF interp prefix /usr/gnemul/qemu-%M
Source path /tmp/qemu-test/src C compiler cc Host C compiler cc C++ compiler Objective-C compiler cc ARFLAGS rv CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g QEMU_CFLAGS -I/usr/include/pixman-1 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g make make install install python python -B smbd /usr/sbin/smbd module support no host CPU x86_64 host big endian no target list x86_64-softmmu aarch64-softmmu tcg debug enabled no gprof enabled no sparse enabled no strip binaries yes profiler no static build no pixman system SDL support yes (1.2.14) GTK support no GTK GL support no VTE support no TLS priority NORMAL GNUTLS support no GNUTLS rnd no libgcrypt no libgcrypt kdf no nettle no nettle kdf no libtasn1 no curses support no virgl support no curl support no mingw32 support no Audio drivers oss Block whitelist (rw) Block whitelist (ro) VirtFS support no VNC support yes VNC SASL support no VNC JPEG support no VNC PNG support no xen support no brlapi support no bluez support no Documentation no PIE yes vde support no netmap support no Linux AIO support no ATTR/XATTR support yes Install blobs yes KVM support yes COLO support yes RDMA support no TCG interpreter no fdt support yes preadv support yes fdatasync yes madvise yes posix_madvise yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
Trace backends log spice support no rbd support no xfsctl support no smartcard support no libusb no usb net redir no OpenGL support no OpenGL dmabufs no libiscsi support no libnfs support no
build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
GlusterFS support no
Archipelago support no
gcov gcov gcov enabled no TPM support yes libssh2 support no TPM passthrough yes QOM debugging yes lzo support no snappy support no bzip2 support no
NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no
replication support yes
GEN x86_64-softmmu/config-devices.mak.tmp GEN aarch64-softmmu/config-devices.mak.tmp GEN qemu-options.def GEN config-host.h GEN qmp-commands.h GEN qapi-types.h GEN qapi-visit.h GEN qapi-event.h GEN qmp-introspect.h GEN x86_64-softmmu/config-devices.mak GEN module_block.h GEN aarch64-softmmu/config-devices.mak GEN tests/test-qapi-visit.h GEN tests/test-qapi-types.h GEN tests/test-qmp-commands.h GEN tests/test-qapi-event.h GEN tests/test-qmp-introspect.h GEN config-all-devices.mak GEN trace/generated-tracers.h GEN trace/generated-tcg-tracers.h GEN trace/generated-helpers-wrappers.h GEN trace/generated-helpers.h CC tests/qemu-iotests/socket_scm_helper.o GEN qga/qapi-generated/qga-qapi-types.h GEN qga/qapi-generated/qga-qapi-visit.h GEN qga/qapi-generated/qga-qmp-commands.h GEN qga/qapi-generated/qga-qapi-types.c GEN qga/qapi-generated/qga-qapi-visit.c GEN qga/qapi-generated/qga-qmp-marshal.c GEN qmp-introspect.c GEN qapi-types.c GEN qapi-visit.c GEN qapi-event.c CC qapi/qapi-visit-core.o CC qapi/qapi-dealloc-visitor.o CC qapi/qobject-input-visitor.o CC qapi/qobject-output-visitor.o CC qapi/qmp-registry.o CC qapi/qmp-dispatch.o CC qapi/string-input-visitor.o CC qapi/opts-visitor.o CC qapi/string-output-visitor.o CC qapi/qapi-clone-visitor.o CC qapi/qapi-util.o CC qapi/qmp-event.o CC qobject/qnull.o CC qobject/qint.o CC qobject/qstring.o CC qobject/qdict.o CC qobject/qlist.o CC qobject/qfloat.o CC qobject/qjson.o CC qobject/qbool.o CC qobject/qobject.o CC qobject/json-lexer.o CC qobject/json-streamer.o CC qobject/json-parser.o GEN trace/generated-tracers.c CC trace/control.o CC trace/qmp.o CC util/osdep.o CC util/cutils.o CC util/unicode.o CC util/qemu-timer-common.o CC util/bufferiszero.o CC util/compatfd.o CC util/event_notifier-posix.o CC util/mmap-alloc.o CC util/oslib-posix.o CC util/qemu-openpty.o CC util/memfd.o CC util/qemu-thread-posix.o CC util/envlist.o CC util/path.o CC util/module.o CC util/bitmap.o CC util/bitops.o CC util/hbitmap.o CC util/fifo8.o CC util/acl.o CC util/error.o CC util/qemu-error.o CC util/id.o CC util/iov.o CC util/qemu-config.o CC util/qemu-sockets.o CC util/uri.o CC util/notify.o CC util/qemu-option.o CC util/qemu-progress.o CC util/hexdump.o CC util/crc32c.o CC util/uuid.o CC util/throttle.o CC util/getauxval.o CC util/readline.o CC util/rcu.o CC util/qemu-coroutine.o CC util/qemu-coroutine-lock.o CC util/qemu-coroutine-io.o CC util/qemu-coroutine-sleep.o CC util/coroutine-ucontext.o CC util/buffer.o CC util/timed-average.o CC util/base64.o CC util/log.o CC util/qdist.o CC util/qht.o CC util/range.o CC crypto/pbkdf-stub.o CC stubs/arch-query-cpu-def.o CC stubs/arch-query-cpu-model-expansion.o CC stubs/arch-query-cpu-model-comparison.o CC stubs/arch-query-cpu-model-baseline.o CC stubs/bdrv-next-monitor-owned.o CC stubs/blk-commit-all.o CC stubs/blockdev-close-all-bdrv-states.o CC stubs/clock-warp.o CC stubs/cpu-get-clock.o CC stubs/cpu-get-icount.o CC stubs/dump.o CC stubs/error-printf.o CC stubs/fdset-add-fd.o CC stubs/fdset-find-fd.o CC stubs/fdset-get-fd.o CC stubs/fdset-remove-fd.o CC stubs/gdbstub.o CC stubs/get-fd.o CC stubs/get-next-serial.o CC stubs/get-vm-name.o CC stubs/iothread.o CC stubs/iothread-lock.o CC stubs/is-daemonized.o CC stubs/machine-init-done.o CC stubs/migr-blocker.o CC stubs/mon-is-qmp.o CC stubs/monitor-init.o CC stubs/notify-event.o CC stubs/qtest.o CC stubs/replay-user.o CC stubs/replay.o CC stubs/reset.o CC stubs/runstate-check.o CC stubs/set-fd-handler.o CC stubs/slirp.o CC stubs/sysbus.o CC stubs/trace-control.o CC stubs/uuid.o CC stubs/vm-stop.o CC stubs/vmstate.o CC stubs/cpus.o CC stubs/kvm.o CC stubs/target-monitor-defs.o CC stubs/qmp_pc_dimm_device_list.o CC stubs/target-get-monitor-def.o CC stubs/vhost.o CC stubs/iohandler.o CC stubs/smbios_type_38.o CC stubs/ipmi.o CC stubs/pc_madt_cpu_entry.o CC stubs/migration-colo.o CC contrib/ivshmem-client/ivshmem-client.o CC contrib/ivshmem-client/main.o CC contrib/ivshmem-server/ivshmem-server.o CC contrib/ivshmem-server/main.o CC qemu-nbd.o CC async.o CC thread-pool.o CC block.o CC blockjob.o CC main-loop.o CC iohandler.o CC qemu-timer.o CC aio-posix.o CC qemu-io-cmds.o CC replication.o CC block/raw_bsd.o CC block/qcow.o CC block/vdi.o CC block/vmdk.o CC block/cloop.o CC block/bochs.o CC block/vpc.o CC block/vvfat.o CC block/dmg.o CC block/qcow2.o CC block/qcow2-refcount.o CC block/qcow2-cluster.o CC block/qcow2-snapshot.o CC block/qcow2-cache.o CC block/qcow2-bitmap.o CC block/qed.o CC block/qed-gencb.o CC block/qed-l2-cache.o CC block/qed-table.o CC block/qed-cluster.o CC block/qed-check.o CC block/vhdx.o CC block/vhdx-endian.o CC block/vhdx-log.o CC block/quorum.o CC block/parallels.o /tmp/qemu-test/src/block/qcow2-bitmap.c: In function ‘bitmap_list_store’: /tmp/qemu-test/src/block/qcow2-bitmap.c:620: warning: ‘ret’ may be used uninitialized in this function CC block/blkdebug.o CC block/blkverify.o CC block/blkreplay.o CC block/block-backend.o CC block/snapshot.o CC block/qapi.o CC block/raw-posix.o CC block/null.o CC block/mirror.o CC block/commit.o CC block/io.o CC block/throttle-groups.o CC block/nbd.o CC block/nbd-client.o CC block/sheepdog.o CC block/accounting.o CC block/dirty-bitmap.o CC block/write-threshold.o CC block/backup.o CC block/replication.o CC block/crypto.o CC nbd/server.o CC nbd/client.o CC nbd/common.o CC crypto/init.o CC crypto/hash.o CC crypto/hash-glib.o CC crypto/aes.o CC crypto/desrfb.o CC crypto/cipher.o CC crypto/tlscreds.o CC crypto/tlscredsanon.o CC crypto/tlscredsx509.o CC crypto/tlssession.o CC crypto/secret.o CC crypto/random-platform.o CC crypto/pbkdf.o CC crypto/ivgen.o CC crypto/ivgen-essiv.o CC crypto/ivgen-plain.o CC crypto/ivgen-plain64.o CC crypto/afsplit.o CC crypto/xts.o CC crypto/block.o CC crypto/block-qcow.o CC crypto/block-luks.o CC io/channel.o CC io/channel-buffer.o CC io/channel-command.o CC io/channel-file.o CC io/channel-socket.o CC io/channel-tls.o CC io/channel-watch.o CC io/channel-websock.o CC io/channel-util.o CC io/task.o CC qom/object.o CC qom/container.o CC qom/qom-qobject.o CC qom/object_interfaces.o GEN qemu-img-cmds.h CC qemu-io.o CC qemu-bridge-helper.o CC blockdev.o CC blockdev-nbd.o CC iothread.o CC qdev-monitor.o CC device-hotplug.o CC os-posix.o CC qemu-char.o CC page_cache.o CC accel.o CC bt-host.o CC bt-vhci.o CC dma-helpers.o CC vl.o CC tpm.o CC device_tree.o GEN qmp-marshal.c CC qmp.o CC hmp.o CC cpus-common.o CC audio/audio.o CC audio/noaudio.o CC audio/wavaudio.o CC audio/mixeng.o CC audio/sdlaudio.o CC audio/ossaudio.o CC audio/wavcapture.o CC backends/rng.o CC backends/rng-egd.o CC backends/msmouse.o CC backends/rng-random.o CC backends/testdev.o CC backends/tpm.o CC backends/hostmem.o CC backends/hostmem-ram.o CC backends/hostmem-file.o CC backends/cryptodev.o CC backends/cryptodev-builtin.o CC block/stream.o CC disas/arm.o CC disas/i386.o CC fsdev/qemu-fsdev-dummy.o CC fsdev/qemu-fsdev-opts.o CC hw/acpi/core.o CC hw/acpi/piix4.o CC hw/acpi/pcihp.o CC hw/acpi/ich9.o CC hw/acpi/tco.o CC hw/acpi/cpu_hotplug.o CC hw/acpi/memory_hotplug.o CC hw/acpi/memory_hotplug_acpi_table.o CC hw/acpi/cpu.o CC hw/acpi/nvdimm.o CC hw/acpi/acpi_interface.o CC hw/acpi/bios-linker-loader.o CC hw/acpi/aml-build.o CC hw/acpi/ipmi.o CC hw/audio/sb16.o CC hw/audio/es1370.o CC hw/audio/ac97.o CC hw/audio/fmopl.o CC hw/audio/adlib.o CC hw/audio/gus.o CC hw/audio/gusemu_hal.o CC hw/audio/gusemu_mixer.o CC hw/audio/cs4231a.o CC hw/audio/hda-codec.o CC hw/audio/intel-hda.o CC hw/audio/pcspk.o CC hw/audio/wm8750.o CC hw/audio/pl041.o CC hw/audio/lm4549.o CC hw/audio/marvell_88w8618.o CC hw/block/block.o CC hw/block/cdrom.o CC hw/block/hd-geometry.o CC hw/block/fdc.o CC hw/block/m25p80.o CC hw/block/nand.o CC hw/block/pflash_cfi01.o CC hw/block/pflash_cfi02.o CC hw/block/ecc.o CC hw/block/onenand.o CC hw/block/nvme.o CC hw/bt/core.o CC hw/bt/l2cap.o CC hw/bt/sdp.o CC hw/bt/hci.o CC hw/bt/hid.o CC hw/bt/hci-csr.o CC hw/char/ipoctal232.o CC hw/char/parallel.o CC hw/char/pl011.o CC hw/char/serial.o CC hw/char/serial-isa.o CC hw/char/serial-pci.o CC hw/char/virtio-console.o CC hw/char/cadence_uart.o CC hw/char/debugcon.o CC hw/char/imx_serial.o CC hw/core/qdev.o CC hw/core/qdev-properties.o CC hw/core/bus.o CC hw/core/fw-path-provider.o CC hw/core/irq.o CC hw/core/hotplug.o CC hw/core/ptimer.o CC hw/core/sysbus.o CC hw/core/machine.o CC hw/core/null-machine.o CC hw/core/loader.o CC hw/core/qdev-properties-system.o CC hw/core/register.o CC hw/core/or-irq.o CC hw/core/platform-bus.o CC hw/display/ads7846.o CC hw/display/cirrus_vga.o CC hw/display/pl110.o CC hw/display/ssd0303.o CC hw/display/ssd0323.o CC hw/display/vga-pci.o CC hw/display/vga-isa.o CC hw/display/vmware_vga.o CC hw/display/blizzard.o CC hw/display/exynos4210_fimd.o CC hw/display/framebuffer.o CC hw/display/tc6393xb.o CC hw/dma/pl080.o CC hw/dma/pl330.o CC hw/dma/i8257.o CC hw/dma/xlnx-zynq-devcfg.o CC hw/gpio/max7310.o CC hw/gpio/pl061.o CC hw/gpio/zaurus.o CC hw/gpio/gpio_key.o CC hw/i2c/core.o CC hw/i2c/smbus.o CC hw/i2c/smbus_eeprom.o CC hw/i2c/i2c-ddc.o CC hw/i2c/versatile_i2c.o CC hw/i2c/smbus_ich9.o CC hw/i2c/pm_smbus.o CC hw/i2c/bitbang_i2c.o CC hw/i2c/exynos4210_i2c.o CC hw/i2c/imx_i2c.o CC hw/i2c/aspeed_i2c.o CC hw/ide/core.o CC hw/ide/atapi.o CC hw/ide/qdev.o CC hw/ide/pci.o CC hw/ide/isa.o CC hw/ide/piix.o CC hw/ide/microdrive.o CC hw/ide/ahci.o CC hw/ide/ich.o CC hw/input/hid.o CC hw/input/lm832x.o CC hw/input/pckbd.o CC hw/input/pl050.o CC hw/input/ps2.o CC hw/input/stellaris_input.o CC hw/input/tsc2005.o CC hw/input/vmmouse.o CC hw/input/virtio-input.o CC hw/input/virtio-input-hid.o CC hw/input/virtio-input-host.o CC hw/intc/i8259_common.o CC hw/intc/i8259.o CC hw/intc/pl190.o CC hw/intc/imx_avic.o CC hw/intc/realview_gic.o CC hw/intc/ioapic_common.o CC hw/intc/arm_gic_common.o CC hw/intc/arm_gic.o CC hw/intc/arm_gicv2m.o CC hw/intc/arm_gicv3_common.o CC hw/intc/arm_gicv3.o CC hw/intc/arm_gicv3_dist.o CC hw/intc/arm_gicv3_redist.o CC hw/intc/arm_gicv3_its_common.o CC hw/intc/intc.o CC hw/ipack/ipack.o CC hw/ipack/tpci200.o CC hw/ipmi/ipmi.o CC hw/ipmi/ipmi_bmc_sim.o CC hw/ipmi/ipmi_bmc_extern.o CC hw/ipmi/isa_ipmi_kcs.o CC hw/ipmi/isa_ipmi_bt.o CC hw/isa/isa-bus.o CC hw/isa/apm.o CC hw/mem/pc-dimm.o CC hw/mem/nvdimm.o CC hw/misc/applesmc.o CC hw/misc/max111x.o CC hw/misc/tmp105.o CC hw/misc/debugexit.o CC hw/misc/sga.o CC hw/misc/pc-testdev.o CC hw/misc/pci-testdev.o CC hw/misc/arm_l2x0.o CC hw/misc/arm_integrator_debug.o CC hw/misc/a9scu.o CC hw/misc/arm11scu.o CC hw/net/ne2000.o CC hw/net/eepro100.o CC hw/net/pcnet-pci.o CC hw/net/pcnet.o CC hw/net/e1000.o CC hw/net/e1000x_common.o CC hw/net/net_tx_pkt.o CC hw/net/net_rx_pkt.o CC hw/net/e1000e.o CC hw/net/e1000e_core.o CC hw/net/rtl8139.o CC hw/net/vmxnet3.o CC hw/net/smc91c111.o CC hw/net/lan9118.o CC hw/net/ne2000-isa.o CC hw/net/xgmac.o CC hw/net/allwinner_emac.o CC hw/net/imx_fec.o CC hw/net/cadence_gem.o CC hw/net/stellaris_enet.o CC hw/net/rocker/rocker.o CC hw/net/rocker/rocker_fp.o CC hw/net/rocker/rocker_desc.o CC hw/net/rocker/rocker_world.o CC hw/net/rocker/rocker_of_dpa.o CC hw/nvram/eeprom93xx.o CC hw/nvram/fw_cfg.o CC hw/nvram/chrp_nvram.o CC hw/pci-bridge/pci_bridge_dev.o CC hw/pci-bridge/pci_expander_bridge.o CC hw/pci-bridge/xio3130_upstream.o CC hw/pci-bridge/xio3130_downstream.o CC hw/pci-bridge/ioh3420.o CC hw/pci-bridge/i82801b11.o CC hw/pci-host/pam.o CC hw/pci-host/versatile.o CC hw/pci-host/piix.o CC hw/pci-host/q35.o CC hw/pci-host/gpex.o CC hw/pci/pci.o CC hw/pci/pci_bridge.o CC hw/pci/msix.o CC hw/pci/msi.o CC hw/pci/shpc.o CC hw/pci/slotid_cap.o CC hw/pci/pci_host.o CC hw/pci/pcie_host.o CC hw/pci/pcie.o CC hw/pci/pcie_aer.o CC hw/pci/pcie_port.o CC hw/pci/pci-stub.o CC hw/pcmcia/pcmcia.o CC hw/scsi/scsi-disk.o CC hw/scsi/scsi-generic.o /tmp/qemu-test/src/hw/nvram/fw_cfg.c: In function ‘fw_cfg_dma_transfer’: /tmp/qemu-test/src/hw/nvram/fw_cfg.c:329: warning: ‘read’ may be used uninitialized in this function CC hw/scsi/scsi-bus.o CC hw/scsi/lsi53c895a.o CC hw/scsi/mptsas.o CC hw/scsi/mptconfig.o CC hw/scsi/mptendian.o CC hw/scsi/megasas.o CC hw/scsi/vmw_pvscsi.o CC hw/scsi/esp.o CC hw/scsi/esp-pci.o CC hw/sd/pl181.o CC hw/sd/ssi-sd.o CC hw/sd/sd.o CC hw/sd/core.o CC hw/sd/sdhci.o CC hw/smbios/smbios.o CC hw/smbios/smbios_type_38.o CC hw/ssi/pl022.o CC hw/ssi/ssi.o CC hw/ssi/xilinx_spips.o CC hw/ssi/aspeed_smc.o CC hw/ssi/stm32f2xx_spi.o CC hw/timer/arm_timer.o CC hw/timer/arm_mptimer.o CC hw/timer/a9gtimer.o CC hw/timer/cadence_ttc.o CC hw/timer/ds1338.o CC hw/timer/hpet.o CC hw/timer/i8254_common.o CC hw/timer/i8254.o CC hw/timer/pl031.o CC hw/timer/twl92230.o CC hw/timer/imx_gpt.o CC hw/timer/imx_epit.o CC hw/timer/stm32f2xx_timer.o CC hw/timer/aspeed_timer.o CC hw/tpm/tpm_tis.o CC hw/tpm/tpm_passthrough.o CC hw/usb/core.o CC hw/tpm/tpm_util.o CC hw/usb/combined-packet.o CC hw/usb/bus.o CC hw/usb/libhw.o CC hw/usb/desc.o CC hw/usb/desc-msos.o CC hw/usb/hcd-uhci.o CC hw/usb/hcd-ohci.o CC hw/usb/hcd-ehci.o CC hw/usb/hcd-ehci-pci.o CC hw/usb/hcd-ehci-sysbus.o CC hw/usb/hcd-xhci.o CC hw/usb/hcd-musb.o CC hw/usb/dev-hub.o CC hw/usb/dev-hid.o CC hw/usb/dev-wacom.o CC hw/usb/dev-storage.o CC hw/usb/dev-uas.o CC hw/usb/dev-serial.o CC hw/usb/dev-audio.o CC hw/usb/dev-network.o CC hw/usb/dev-bluetooth.o CC hw/usb/dev-smartcard-reader.o CC hw/usb/dev-mtp.o CC hw/usb/host-stub.o CC hw/virtio/virtio-rng.o CC hw/virtio/virtio-pci.o CC hw/virtio/virtio-bus.o CC hw/virtio/virtio-mmio.o CC hw/watchdog/watchdog.o CC hw/watchdog/wdt_i6300esb.o CC hw/watchdog/wdt_ib700.o CC migration/migration.o CC migration/socket.o CC migration/fd.o CC migration/exec.o CC migration/tls.o CC migration/colo-comm.o CC migration/colo.o CC migration/colo-failover.o CC migration/vmstate.o CC migration/qemu-file.o CC migration/qemu-file-channel.o CC migration/xbzrle.o CC migration/postcopy-ram.o CC migration/qjson.o CC migration/block.o CC net/net.o CC net/queue.o CC net/checksum.o CC net/util.o CC net/hub.o CC net/socket.o CC net/dump.o CC net/eth.o CC net/l2tpv3.o CC net/tap.o CC net/vhost-user.o CC net/tap-linux.o CC net/slirp.o CC net/filter.o CC net/filter-buffer.o CC net/filter-mirror.o CC net/colo-compare.o CC net/colo.o CC net/filter-rewriter.o CC qom/cpu.o CC replay/replay.o CC replay/replay-internal.o CC replay/replay-events.o /tmp/qemu-test/src/replay/replay-internal.c: In function ‘replay_put_array’: /tmp/qemu-test/src/replay/replay-internal.c:65: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result CC replay/replay-time.o CC replay/replay-input.o CC replay/replay-char.o CC slirp/cksum.o CC replay/replay-snapshot.o CC slirp/if.o CC slirp/ip_icmp.o CC slirp/ip6_icmp.o CC slirp/ip6_input.o CC slirp/ip6_output.o CC slirp/ip_input.o CC slirp/ip_output.o CC slirp/dnssearch.o CC slirp/dhcpv6.o CC slirp/slirp.o CC slirp/mbuf.o CC slirp/misc.o CC slirp/sbuf.o CC slirp/socket.o CC slirp/tcp_input.o CC slirp/tcp_output.o CC slirp/tcp_subr.o CC slirp/tcp_timer.o CC slirp/udp.o CC slirp/udp6.o CC slirp/bootp.o CC slirp/tftp.o CC slirp/arp_table.o CC slirp/ndp_table.o CC ui/keymaps.o CC ui/console.o CC ui/cursor.o CC ui/qemu-pixman.o CC ui/input.o CC ui/input-keymap.o CC ui/input-legacy.o CC ui/input-linux.o CC ui/sdl.o CC ui/vnc.o CC ui/sdl_zoom.o CC ui/x_keymap.o CC ui/vnc-enc-zlib.o CC ui/vnc-enc-hextile.o CC ui/vnc-enc-tight.o CC ui/vnc-palette.o CC ui/vnc-enc-zrle.o CC ui/vnc-auth-vencrypt.o
/tmp/qemu-test/src/slirp/tcp_input.c: In function ‘tcp_input’:/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_p’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_len’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_tos’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_id’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_off’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_ttl’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_sum’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_src.s_addr’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_dst.s_addr’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:220: warning: ‘save_ip6.ip_nh’ may be used uninitialized in this function
CC ui/vnc-ws.o CC ui/vnc-jobs.o LINK tests/qemu-iotests/socket_scm_helper CC qga/commands.o CC qga/guest-agent-command-state.o CC qga/main.o CC qga/commands-posix.o AS optionrom/multiboot.o CC qga/channel-posix.o AS optionrom/linuxboot.o CC optionrom/linuxboot_dma.o
AS optionrom/kvmvapic.o BUILD optionrom/multiboot.img BUILD optionrom/linuxboot.img BUILD optionrom/linuxboot_dma.img BUILD optionrom/kvmvapic.img BUILD optionrom/multiboot.raw CC qga/qapi-generated/qga-qapi-types.o BUILD optionrom/linuxboot.raw BUILD optionrom/linuxboot_dma.raw BUILD optionrom/kvmvapic.raw SIGN optionrom/multiboot.bin SIGN optionrom/linuxboot.bin SIGN optionrom/linuxboot_dma.bin CC qga/qapi-generated/qga-qapi-visit.o SIGN optionrom/kvmvapic.bin CC qga/qapi-generated/qga-qmp-marshal.o CC qmp-introspect.o CC qapi-types.o CC qapi-visit.o CC qapi-event.o AR libqemustub.a CC qemu-img.o CC qmp-marshal.o CC trace/generated-tracers.o AR libqemuutil.a LINK qemu-ga LINK ivshmem-client LINK ivshmem-server LINK qemu-nbd LINK qemu-img LINK qemu-io LINK qemu-bridge-helper GEN aarch64-softmmu/hmp-commands.h GEN aarch64-softmmu/hmp-commands-info.h GEN aarch64-softmmu/config-target.h GEN x86_64-softmmu/hmp-commands.h GEN x86_64-softmmu/hmp-commands-info.h GEN x86_64-softmmu/config-target.h CC aarch64-softmmu/translate-all.o CC aarch64-softmmu/exec.o CC aarch64-softmmu/cpu-exec.o CC aarch64-softmmu/tcg/tcg.o CC aarch64-softmmu/translate-common.o CC aarch64-softmmu/cpu-exec-common.o CC aarch64-softmmu/tcg/tcg-op.o CC aarch64-softmmu/tcg/optimize.o CC aarch64-softmmu/tcg/tcg-common.o CC aarch64-softmmu/fpu/softfloat.o CC aarch64-softmmu/disas.o CC aarch64-softmmu/tcg-runtime.o GEN aarch64-softmmu/gdbstub-xml.c CC aarch64-softmmu/kvm-stub.o CC aarch64-softmmu/arch_init.o CC aarch64-softmmu/cpus.o CC x86_64-softmmu/exec.o CC aarch64-softmmu/monitor.o CC aarch64-softmmu/gdbstub.o CC aarch64-softmmu/balloon.o CC x86_64-softmmu/translate-all.o CC x86_64-softmmu/cpu-exec.o CC aarch64-softmmu/ioport.o CC aarch64-softmmu/numa.o CC aarch64-softmmu/qtest.o CC x86_64-softmmu/translate-common.o CC x86_64-softmmu/cpu-exec-common.o CC aarch64-softmmu/bootdevice.o CC x86_64-softmmu/tcg/tcg.o CC x86_64-softmmu/tcg/tcg-op.o CC aarch64-softmmu/memory.o CC x86_64-softmmu/tcg/optimize.o CC x86_64-softmmu/tcg/tcg-common.o CC x86_64-softmmu/fpu/softfloat.o CC aarch64-softmmu/cputlb.o CC aarch64-softmmu/memory_mapping.o CC aarch64-softmmu/dump.o CC aarch64-softmmu/migration/ram.o CC aarch64-softmmu/migration/savevm.o CC x86_64-softmmu/disas.o CC x86_64-softmmu/tcg-runtime.o CC aarch64-softmmu/xen-common-stub.o CC aarch64-softmmu/xen-hvm-stub.o CC x86_64-softmmu/arch_init.o CC aarch64-softmmu/hw/adc/stm32f2xx_adc.o CC aarch64-softmmu/hw/block/virtio-blk.o CC aarch64-softmmu/hw/block/dataplane/virtio-blk.o CC aarch64-softmmu/hw/char/exynos4210_uart.o CC aarch64-softmmu/hw/char/omap_uart.o CC x86_64-softmmu/cpus.o CC x86_64-softmmu/monitor.o CC x86_64-softmmu/gdbstub.o CC x86_64-softmmu/balloon.o CC x86_64-softmmu/ioport.o CC aarch64-softmmu/hw/char/digic-uart.o CC aarch64-softmmu/hw/char/stm32f2xx_usart.o CC x86_64-softmmu/numa.o CC x86_64-softmmu/qtest.o CC aarch64-softmmu/hw/char/bcm2835_aux.o CC aarch64-softmmu/hw/char/virtio-serial-bus.o CC aarch64-softmmu/hw/core/nmi.o CC aarch64-softmmu/hw/core/generic-loader.o CC x86_64-softmmu/bootdevice.o CC x86_64-softmmu/kvm-all.o CC x86_64-softmmu/memory.o CC aarch64-softmmu/hw/cpu/arm11mpcore.o CC x86_64-softmmu/cputlb.o CC aarch64-softmmu/hw/cpu/realview_mpcore.o CC x86_64-softmmu/memory_mapping.o CC x86_64-softmmu/dump.o CC x86_64-softmmu/migration/ram.o CC aarch64-softmmu/hw/cpu/a9mpcore.o CC x86_64-softmmu/migration/savevm.o CC x86_64-softmmu/xen-common-stub.o CC x86_64-softmmu/xen-hvm-stub.o CC aarch64-softmmu/hw/cpu/a15mpcore.o CC aarch64-softmmu/hw/cpu/core.o CC aarch64-softmmu/hw/display/omap_dss.o CC aarch64-softmmu/hw/display/omap_lcdc.o CC x86_64-softmmu/hw/block/virtio-blk.o CC aarch64-softmmu/hw/display/pxa2xx_lcd.o CC x86_64-softmmu/hw/block/dataplane/virtio-blk.o CC aarch64-softmmu/hw/display/bcm2835_fb.o CC x86_64-softmmu/hw/char/virtio-serial-bus.o CC x86_64-softmmu/hw/core/nmi.o CC x86_64-softmmu/hw/core/generic-loader.o CC aarch64-softmmu/hw/display/vga.o CC aarch64-softmmu/hw/display/virtio-gpu.o CC aarch64-softmmu/hw/display/virtio-gpu-3d.o CC x86_64-softmmu/hw/cpu/core.o CC aarch64-softmmu/hw/display/virtio-gpu-pci.o CC x86_64-softmmu/hw/display/vga.o CC x86_64-softmmu/hw/display/virtio-gpu.o CC x86_64-softmmu/hw/display/virtio-gpu-3d.o CC x86_64-softmmu/hw/display/virtio-gpu-pci.o CC aarch64-softmmu/hw/display/dpcd.o CC x86_64-softmmu/hw/display/virtio-vga.o CC x86_64-softmmu/hw/intc/apic.o CC x86_64-softmmu/hw/intc/apic_common.o CC x86_64-softmmu/hw/intc/ioapic.o CC aarch64-softmmu/hw/display/xlnx_dp.o CC aarch64-softmmu/hw/dma/xlnx_dpdma.o CC aarch64-softmmu/hw/dma/omap_dma.o CC x86_64-softmmu/hw/isa/lpc_ich9.o CC aarch64-softmmu/hw/dma/soc_dma.o CC aarch64-softmmu/hw/dma/pxa2xx_dma.o CC aarch64-softmmu/hw/dma/bcm2835_dma.o CC aarch64-softmmu/hw/gpio/omap_gpio.o CC x86_64-softmmu/hw/misc/vmport.o CC aarch64-softmmu/hw/gpio/imx_gpio.o CC aarch64-softmmu/hw/i2c/omap_i2c.o CC x86_64-softmmu/hw/misc/ivshmem.o CC x86_64-softmmu/hw/misc/pvpanic.o CC aarch64-softmmu/hw/input/pxa2xx_keypad.o CC aarch64-softmmu/hw/input/tsc210x.o CC aarch64-softmmu/hw/intc/armv7m_nvic.o CC x86_64-softmmu/hw/misc/edu.o CC aarch64-softmmu/hw/intc/exynos4210_gic.o CC aarch64-softmmu/hw/intc/exynos4210_combiner.o CC aarch64-softmmu/hw/intc/omap_intc.o CC x86_64-softmmu/hw/net/virtio-net.o CC x86_64-softmmu/hw/misc/hyperv_testdev.o CC x86_64-softmmu/hw/net/vhost_net.o CC x86_64-softmmu/hw/scsi/virtio-scsi.o CC x86_64-softmmu/hw/scsi/virtio-scsi-dataplane.o CC x86_64-softmmu/hw/scsi/vhost-scsi.o CC aarch64-softmmu/hw/intc/bcm2835_ic.o CC aarch64-softmmu/hw/intc/bcm2836_control.o CC aarch64-softmmu/hw/intc/allwinner-a10-pic.o CC x86_64-softmmu/hw/timer/mc146818rtc.o CC aarch64-softmmu/hw/intc/aspeed_vic.o CC aarch64-softmmu/hw/intc/arm_gicv3_cpuif.o CC x86_64-softmmu/hw/vfio/common.o CC aarch64-softmmu/hw/misc/ivshmem.o CC aarch64-softmmu/hw/misc/arm_sysctl.o CC aarch64-softmmu/hw/misc/cbus.o CC aarch64-softmmu/hw/misc/exynos4210_pmu.o CC x86_64-softmmu/hw/vfio/pci.o CC x86_64-softmmu/hw/vfio/pci-quirks.o CC x86_64-softmmu/hw/vfio/platform.o CC aarch64-softmmu/hw/misc/imx_ccm.o CC x86_64-softmmu/hw/vfio/calxeda-xgmac.o CC x86_64-softmmu/hw/vfio/amd-xgbe.o CC x86_64-softmmu/hw/vfio/spapr.o CC aarch64-softmmu/hw/misc/imx31_ccm.o CC aarch64-softmmu/hw/misc/imx25_ccm.o CC aarch64-softmmu/hw/misc/imx6_ccm.o CC aarch64-softmmu/hw/misc/imx6_src.o CC aarch64-softmmu/hw/misc/mst_fpga.o CC aarch64-softmmu/hw/misc/omap_clk.o CC x86_64-softmmu/hw/virtio/virtio.o CC x86_64-softmmu/hw/virtio/virtio-balloon.o CC aarch64-softmmu/hw/misc/omap_gpmc.o CC aarch64-softmmu/hw/misc/omap_l4.o CC aarch64-softmmu/hw/misc/omap_sdrc.o CC x86_64-softmmu/hw/virtio/vhost.o CC x86_64-softmmu/hw/virtio/vhost-backend.o CC x86_64-softmmu/hw/virtio/vhost-user.o CC x86_64-softmmu/hw/virtio/vhost-vsock.o CC x86_64-softmmu/hw/virtio/virtio-crypto.o CC aarch64-softmmu/hw/misc/omap_tap.o CC x86_64-softmmu/hw/virtio/virtio-crypto-pci.o CC x86_64-softmmu/hw/i386/multiboot.o CC x86_64-softmmu/hw/i386/pc.o CC aarch64-softmmu/hw/misc/bcm2835_mbox.o CC aarch64-softmmu/hw/misc/bcm2835_property.o CC x86_64-softmmu/hw/i386/pc_piix.o CC x86_64-softmmu/hw/i386/pc_q35.o CC x86_64-softmmu/hw/i386/pc_sysfw.o CC x86_64-softmmu/hw/i386/x86-iommu.o CC x86_64-softmmu/hw/i386/intel_iommu.o CC aarch64-softmmu/hw/misc/zynq_slcr.o CC x86_64-softmmu/hw/i386/amd_iommu.o CC aarch64-softmmu/hw/misc/zynq-xadc.o CC x86_64-softmmu/hw/i386/kvmvapic.o CC x86_64-softmmu/hw/i386/acpi-build.o CC x86_64-softmmu/hw/i386/pci-assign-load-rom.o CC aarch64-softmmu/hw/misc/stm32f2xx_syscfg.o CC x86_64-softmmu/hw/i386/kvm/clock.o CC x86_64-softmmu/hw/i386/kvm/apic.o CC aarch64-softmmu/hw/misc/edu.o CC x86_64-softmmu/hw/i386/kvm/i8259.o CC aarch64-softmmu/hw/misc/auxbus.o CC x86_64-softmmu/hw/i386/kvm/ioapic.o CC x86_64-softmmu/hw/i386/kvm/i8254.o CC aarch64-softmmu/hw/misc/aspeed_scu.o CC x86_64-softmmu/hw/i386/kvm/pci-assign.o /tmp/qemu-test/src/hw/i386/pc_piix.c: In function ‘igd_passthrough_isa_bridge_create’: /tmp/qemu-test/src/hw/i386/pc_piix.c:1046: warning: ‘pch_rev_id’ may be used uninitialized in this function CC aarch64-softmmu/hw/misc/aspeed_sdmc.o CC aarch64-softmmu/hw/net/virtio-net.o CC aarch64-softmmu/hw/net/vhost_net.o CC x86_64-softmmu/target-i386/translate.o CC aarch64-softmmu/hw/pcmcia/pxa2xx.o CC aarch64-softmmu/hw/scsi/virtio-scsi.o CC aarch64-softmmu/hw/scsi/virtio-scsi-dataplane.o CC aarch64-softmmu/hw/scsi/vhost-scsi.o CC aarch64-softmmu/hw/sd/omap_mmc.o CC aarch64-softmmu/hw/sd/pxa2xx_mmci.o CC aarch64-softmmu/hw/ssi/omap_spi.o CC aarch64-softmmu/hw/ssi/imx_spi.o CC aarch64-softmmu/hw/timer/exynos4210_mct.o CC x86_64-softmmu/target-i386/helper.o /tmp/qemu-test/src/hw/i386/acpi-build.c: In function ‘build_append_pci_bus_devices’: /tmp/qemu-test/src/hw/i386/acpi-build.c:501: warning: ‘notify_method’ may be used uninitialized in this function CC x86_64-softmmu/target-i386/cpu.o CC aarch64-softmmu/hw/timer/exynos4210_pwm.o CC aarch64-softmmu/hw/timer/exynos4210_rtc.o CC x86_64-softmmu/target-i386/bpt_helper.o CC aarch64-softmmu/hw/timer/omap_gptimer.o CC aarch64-softmmu/hw/timer/omap_synctimer.o CC x86_64-softmmu/target-i386/excp_helper.o CC aarch64-softmmu/hw/timer/pxa2xx_timer.o CC aarch64-softmmu/hw/timer/digic-timer.o CC x86_64-softmmu/target-i386/fpu_helper.o CC aarch64-softmmu/hw/timer/allwinner-a10-pit.o CC x86_64-softmmu/target-i386/cc_helper.o CC aarch64-softmmu/hw/usb/tusb6010.o CC aarch64-softmmu/hw/vfio/common.o CC x86_64-softmmu/target-i386/int_helper.o CC x86_64-softmmu/target-i386/svm_helper.o CC x86_64-softmmu/target-i386/smm_helper.o CC aarch64-softmmu/hw/vfio/pci.o CC x86_64-softmmu/target-i386/misc_helper.o CC aarch64-softmmu/hw/vfio/pci-quirks.o CC x86_64-softmmu/target-i386/mem_helper.o CC aarch64-softmmu/hw/vfio/platform.o CC aarch64-softmmu/hw/vfio/calxeda-xgmac.o CC x86_64-softmmu/target-i386/seg_helper.o CC aarch64-softmmu/hw/vfio/amd-xgbe.o CC x86_64-softmmu/target-i386/mpx_helper.o CC aarch64-softmmu/hw/vfio/spapr.o CC x86_64-softmmu/target-i386/gdbstub.o CC aarch64-softmmu/hw/virtio/virtio.o CC x86_64-softmmu/target-i386/machine.o CC aarch64-softmmu/hw/virtio/virtio-balloon.o CC aarch64-softmmu/hw/virtio/vhost.o CC x86_64-softmmu/target-i386/arch_memory_mapping.o CC aarch64-softmmu/hw/virtio/vhost-backend.o CC x86_64-softmmu/target-i386/arch_dump.o CC x86_64-softmmu/target-i386/monitor.o CC aarch64-softmmu/hw/virtio/vhost-user.o CC aarch64-softmmu/hw/virtio/vhost-vsock.o CC aarch64-softmmu/hw/virtio/virtio-crypto.o CC aarch64-softmmu/hw/virtio/virtio-crypto-pci.o CC x86_64-softmmu/target-i386/kvm.o CC x86_64-softmmu/target-i386/hyperv.o CC aarch64-softmmu/hw/arm/boot.o CC aarch64-softmmu/hw/arm/collie.o CC aarch64-softmmu/hw/arm/exynos4_boards.o CC aarch64-softmmu/hw/arm/gumstix.o GEN trace/generated-helpers.c CC x86_64-softmmu/trace/control-target.o CC aarch64-softmmu/hw/arm/highbank.o CC aarch64-softmmu/hw/arm/digic_boards.o CC aarch64-softmmu/hw/arm/integratorcp.o CC x86_64-softmmu/trace/generated-helpers.o CC aarch64-softmmu/hw/arm/mainstone.o CC aarch64-softmmu/hw/arm/musicpal.o CC aarch64-softmmu/hw/arm/nseries.o CC aarch64-softmmu/hw/arm/omap_sx1.o CC aarch64-softmmu/hw/arm/palm.o CC aarch64-softmmu/hw/arm/realview.o CC aarch64-softmmu/hw/arm/spitz.o CC aarch64-softmmu/hw/arm/stellaris.o CC aarch64-softmmu/hw/arm/tosa.o CC aarch64-softmmu/hw/arm/versatilepb.o CC aarch64-softmmu/hw/arm/vexpress.o CC aarch64-softmmu/hw/arm/virt.o CC aarch64-softmmu/hw/arm/xilinx_zynq.o CC aarch64-softmmu/hw/arm/z2.o CC aarch64-softmmu/hw/arm/virt-acpi-build.o CC aarch64-softmmu/hw/arm/netduino2.o CC aarch64-softmmu/hw/arm/sysbus-fdt.o CC aarch64-softmmu/hw/arm/armv7m.o CC aarch64-softmmu/hw/arm/pxa2xx.o CC aarch64-softmmu/hw/arm/exynos4210.o CC aarch64-softmmu/hw/arm/pxa2xx_gpio.o CC aarch64-softmmu/hw/arm/pxa2xx_pic.o CC aarch64-softmmu/hw/arm/digic.o CC aarch64-softmmu/hw/arm/omap1.o CC aarch64-softmmu/hw/arm/omap2.o CC aarch64-softmmu/hw/arm/strongarm.o CC aarch64-softmmu/hw/arm/allwinner-a10.o CC aarch64-softmmu/hw/arm/cubieboard.o CC aarch64-softmmu/hw/arm/bcm2836.o CC aarch64-softmmu/hw/arm/bcm2835_peripherals.o CC aarch64-softmmu/hw/arm/raspi.o CC aarch64-softmmu/hw/arm/stm32f205_soc.o CC aarch64-softmmu/hw/arm/xlnx-zynqmp.o CC aarch64-softmmu/hw/arm/xlnx-ep108.o CC aarch64-softmmu/hw/arm/fsl-imx25.o CC aarch64-softmmu/hw/arm/imx25_pdk.o CC aarch64-softmmu/hw/arm/fsl-imx31.o CC aarch64-softmmu/hw/arm/kzm.o CC aarch64-softmmu/hw/arm/fsl-imx6.o CC aarch64-softmmu/hw/arm/sabrelite.o CC aarch64-softmmu/hw/arm/aspeed_soc.o CC aarch64-softmmu/hw/arm/aspeed.o CC aarch64-softmmu/target-arm/arm-semi.o CC aarch64-softmmu/target-arm/machine.o CC aarch64-softmmu/target-arm/psci.o CC aarch64-softmmu/target-arm/arch_dump.o CC aarch64-softmmu/target-arm/monitor.o CC aarch64-softmmu/target-arm/kvm-stub.o CC aarch64-softmmu/target-arm/translate.o CC aarch64-softmmu/target-arm/op_helper.o CC aarch64-softmmu/target-arm/helper.o CC aarch64-softmmu/target-arm/cpu.o CC aarch64-softmmu/target-arm/neon_helper.o CC aarch64-softmmu/target-arm/iwmmxt_helper.o CC aarch64-softmmu/target-arm/gdbstub.o CC aarch64-softmmu/target-arm/cpu64.o CC aarch64-softmmu/target-arm/translate-a64.o CC aarch64-softmmu/target-arm/helper-a64.o CC aarch64-softmmu/target-arm/gdbstub64.o CC aarch64-softmmu/target-arm/crypto_helper.o CC aarch64-softmmu/target-arm/arm-powerctl.o GEN trace/generated-helpers.c CC aarch64-softmmu/trace/control-target.o LINK x86_64-softmmu/qemu-system-x86_64 CC aarch64-softmmu/gdbstub-xml.o CC aarch64-softmmu/trace/generated-helpers.o
/tmp/qemu-test/src/target-arm/translate-a64.c: In function ‘handle_shri_with_rndacc’:/tmp/qemu-test/src/target-arm/translate-a64.c:6395: warning: ‘tcg_src_hi’ may be used uninitialized in this function /tmp/qemu-test/src/target-arm/translate-a64.c: In function ‘disas_simd_scalar_two_reg_misc’:/tmp/qemu-test/src/target-arm/translate-a64.c:8122: warning: ‘rmode’ may be used uninitialized in this function
LINK aarch64-softmmu/qemu-system-aarch64 TEST tests/qapi-schema/alternate-any.out TEST tests/qapi-schema/alternate-array.out TEST tests/qapi-schema/alternate-base.out TEST tests/qapi-schema/alternate-clash.out TEST tests/qapi-schema/alternate-conflict-dict.out TEST tests/qapi-schema/alternate-conflict-string.out TEST tests/qapi-schema/alternate-empty.out TEST tests/qapi-schema/alternate-nested.out TEST tests/qapi-schema/alternate-unknown.out TEST tests/qapi-schema/args-alternate.out TEST tests/qapi-schema/args-any.out TEST tests/qapi-schema/args-array-empty.out TEST tests/qapi-schema/args-array-unknown.out TEST tests/qapi-schema/args-bad-boxed.out TEST tests/qapi-schema/args-boxed-anon.out TEST tests/qapi-schema/args-boxed-empty.out TEST tests/qapi-schema/args-boxed-string.out TEST tests/qapi-schema/args-int.out TEST tests/qapi-schema/args-invalid.out TEST tests/qapi-schema/args-member-array-bad.out TEST tests/qapi-schema/args-member-case.out TEST tests/qapi-schema/args-member-unknown.out TEST tests/qapi-schema/args-name-clash.out TEST tests/qapi-schema/args-union.out TEST tests/qapi-schema/args-unknown.out TEST tests/qapi-schema/bad-base.out TEST tests/qapi-schema/bad-data.out TEST tests/qapi-schema/bad-ident.out TEST tests/qapi-schema/bad-type-bool.out TEST tests/qapi-schema/bad-type-dict.out TEST tests/qapi-schema/bad-type-int.out TEST tests/qapi-schema/base-cycle-direct.out TEST tests/qapi-schema/base-cycle-indirect.out TEST tests/qapi-schema/command-int.out TEST tests/qapi-schema/comments.out TEST tests/qapi-schema/double-data.out TEST tests/qapi-schema/double-type.out TEST tests/qapi-schema/duplicate-key.out TEST tests/qapi-schema/empty.out TEST tests/qapi-schema/enum-bad-name.out TEST tests/qapi-schema/enum-bad-prefix.out TEST tests/qapi-schema/enum-clash-member.out TEST tests/qapi-schema/enum-dict-member.out TEST tests/qapi-schema/enum-int-member.out TEST tests/qapi-schema/enum-member-case.out TEST tests/qapi-schema/enum-missing-data.out TEST tests/qapi-schema/enum-wrong-data.out TEST tests/qapi-schema/escape-outside-string.out TEST tests/qapi-schema/escape-too-big.out TEST tests/qapi-schema/escape-too-short.out TEST tests/qapi-schema/event-boxed-empty.out TEST tests/qapi-schema/event-nest-struct.out TEST tests/qapi-schema/event-case.out TEST tests/qapi-schema/flat-union-bad-base.out TEST tests/qapi-schema/flat-union-array-branch.out TEST tests/qapi-schema/flat-union-bad-discriminator.out TEST tests/qapi-schema/flat-union-base-union.out TEST tests/qapi-schema/flat-union-base-any.out TEST tests/qapi-schema/flat-union-clash-member.out TEST tests/qapi-schema/flat-union-incomplete-branch.out TEST tests/qapi-schema/flat-union-empty.out TEST tests/qapi-schema/flat-union-int-branch.out TEST tests/qapi-schema/flat-union-inline.out TEST tests/qapi-schema/flat-union-invalid-branch-key.out TEST tests/qapi-schema/flat-union-invalid-discriminator.out TEST tests/qapi-schema/flat-union-no-base.out TEST tests/qapi-schema/flat-union-optional-discriminator.out TEST tests/qapi-schema/flat-union-string-discriminator.out TEST tests/qapi-schema/funny-char.out TEST tests/qapi-schema/ident-with-escape.out TEST tests/qapi-schema/include-before-err.out TEST tests/qapi-schema/include-cycle.out TEST tests/qapi-schema/include-format-err.out TEST tests/qapi-schema/include-nested-err.out TEST tests/qapi-schema/include-no-file.out TEST tests/qapi-schema/include-non-file.out TEST tests/qapi-schema/include-relpath.out TEST tests/qapi-schema/include-repetition.out TEST tests/qapi-schema/include-self-cycle.out TEST tests/qapi-schema/include-simple.out TEST tests/qapi-schema/indented-expr.out TEST tests/qapi-schema/leading-comma-list.out TEST tests/qapi-schema/leading-comma-object.out TEST tests/qapi-schema/missing-colon.out TEST tests/qapi-schema/missing-comma-list.out TEST tests/qapi-schema/missing-comma-object.out TEST tests/qapi-schema/missing-type.out TEST tests/qapi-schema/nested-struct-data.out TEST tests/qapi-schema/non-objects.out TEST tests/qapi-schema/quoted-structural-chars.out TEST tests/qapi-schema/qapi-schema-test.out TEST tests/qapi-schema/redefined-builtin.out TEST tests/qapi-schema/redefined-command.out TEST tests/qapi-schema/redefined-event.out TEST tests/qapi-schema/redefined-type.out TEST tests/qapi-schema/reserved-command-q.out TEST tests/qapi-schema/reserved-enum-q.out TEST tests/qapi-schema/reserved-member-has.out TEST tests/qapi-schema/reserved-member-q.out TEST tests/qapi-schema/reserved-member-underscore.out TEST tests/qapi-schema/reserved-member-u.out TEST tests/qapi-schema/reserved-type-kind.out TEST tests/qapi-schema/reserved-type-list.out TEST tests/qapi-schema/returns-alternate.out TEST tests/qapi-schema/returns-array-bad.out TEST tests/qapi-schema/returns-dict.out TEST tests/qapi-schema/returns-unknown.out TEST tests/qapi-schema/returns-whitelist.out TEST tests/qapi-schema/struct-base-clash-deep.out TEST tests/qapi-schema/struct-base-clash.out TEST tests/qapi-schema/struct-data-invalid.out TEST tests/qapi-schema/trailing-comma-list.out TEST tests/qapi-schema/struct-member-invalid.out TEST tests/qapi-schema/trailing-comma-object.out TEST tests/qapi-schema/type-bypass-bad-gen.out TEST tests/qapi-schema/unclosed-list.out TEST tests/qapi-schema/unclosed-object.out TEST tests/qapi-schema/unclosed-string.out TEST tests/qapi-schema/unicode-str.out TEST tests/qapi-schema/union-base-no-discriminator.out TEST tests/qapi-schema/union-branch-case.out TEST tests/qapi-schema/union-clash-branches.out TEST tests/qapi-schema/union-empty.out TEST tests/qapi-schema/union-invalid-base.out TEST tests/qapi-schema/union-optional-branch.out TEST tests/qapi-schema/union-unknown.out TEST tests/qapi-schema/unknown-escape.out TEST tests/qapi-schema/unknown-expr-key.out CC tests/check-qdict.o CC tests/test-char.o CC tests/check-qfloat.o CC tests/check-qint.o CC tests/check-qlist.o CC tests/check-qstring.o CC tests/check-qnull.o CC tests/check-qjson.o GEN tests/test-qapi-types.c CC tests/test-qobject-output-visitor.o GEN tests/test-qapi-visit.c GEN tests/test-qapi-event.c GEN tests/test-qmp-introspect.c CC tests/test-clone-visitor.o CC tests/test-qobject-input-visitor.o CC tests/test-qobject-input-strict.o CC tests/test-qmp-commands.o GEN tests/test-qmp-marshal.c CC tests/test-string-input-visitor.o CC tests/test-string-output-visitor.o CC tests/test-qmp-event.o CC tests/test-opts-visitor.o CC tests/test-coroutine.o CC tests/test-visitor-serialization.o CC tests/test-iov.o CC tests/test-aio.o CC tests/test-throttle.o CC tests/test-thread-pool.o CC tests/test-hbitmap.o CC tests/test-blockjob.o CC tests/test-blockjob-txn.o CC tests/test-x86-cpuid.o CC tests/test-xbzrle.o CC tests/test-vmstate.o CC tests/test-cutils.o CC tests/test-mul64.o CC tests/test-int128.o CC tests/rcutorture.o /tmp/qemu-test/src/tests/test-int128.c:180: warning: ‘__noclone__’ attribute directive ignored CC tests/test-qdist.o CC tests/test-rcu-list.o CC tests/test-qht.o CC tests/test-qht-par.o CC tests/qht-bench.o CC tests/test-bitops.o CC tests/check-qom-interface.o CC tests/check-qom-proplist.o CC tests/test-qemu-opts.o CC tests/test-write-threshold.o CC tests/test-crypto-hash.o CC tests/test-crypto-cipher.o CC tests/test-crypto-secret.o CC tests/test-qga.o CC tests/libqtest.o CC tests/test-timed-average.o CC tests/test-io-task.o CC tests/test-io-channel-socket.o CC tests/io-channel-helpers.o CC tests/test-io-channel-file.o CC tests/test-io-channel-command.o CC tests/test-io-channel-buffer.o CC tests/test-base64.o CC tests/test-crypto-ivgen.o CC tests/test-crypto-afsplit.o CC tests/test-crypto-xts.o CC tests/test-crypto-block.o CC tests/test-logging.o CC tests/test-replication.o CC tests/test-bufferiszero.o CC tests/test-uuid.o CC tests/ptimer-test.o CC tests/ptimer-test-stubs.o CC tests/vhost-user-test.o CC tests/libqos/pci.o CC tests/libqos/fw_cfg.o CC tests/libqos/malloc.o CC tests/libqos/i2c.o CC tests/libqos/libqos.o CC tests/libqos/malloc-spapr.o CC tests/libqos/libqos-spapr.o CC tests/libqos/rtas.o CC tests/libqos/pci-spapr.o CC tests/libqos/pci-pc.o CC tests/libqos/malloc-pc.o CC tests/libqos/libqos-pc.o CC tests/libqos/ahci.o CC tests/libqos/virtio.o CC tests/libqos/virtio-pci.o CC tests/libqos/virtio-mmio.o CC tests/libqos/malloc-generic.o CC tests/endianness-test.o CC tests/fdc-test.o CC tests/ide-test.o CC tests/ahci-test.o CC tests/hd-geo-test.o CC tests/boot-order-test.o CC tests/bios-tables-test.o CC tests/boot-sector.o CC tests/boot-serial-test.o CC tests/pxe-test.o CC tests/rtc-test.o CC tests/ipmi-kcs-test.o CC tests/ipmi-bt-test.o CC tests/i440fx-test.o CC tests/fw_cfg-test.o CC tests/drive_del-test.o CC tests/wdt_ib700-test.o CC tests/tco-test.o
/tmp/qemu-test/src/tests/ide-test.c: In function ‘cdrom_pio_impl’:/tmp/qemu-test/src/tests/ide-test.c:791: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result /tmp/qemu-test/src/tests/ide-test.c: In function ‘test_cdrom_dma’:/tmp/qemu-test/src/tests/ide-test.c:886: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
CC tests/e1000-test.o CC tests/e1000e-test.o CC tests/pcnet-test.o CC tests/rtl8139-test.o CC tests/eepro100-test.o CC tests/ne2000-test.o CC tests/nvme-test.o CC tests/ac97-test.o CC tests/es1370-test.o CC tests/virtio-net-test.o CC tests/virtio-balloon-test.o CC tests/virtio-blk-test.o CC tests/virtio-rng-test.o CC tests/virtio-scsi-test.o CC tests/virtio-console-test.o CC tests/virtio-serial-test.o CC tests/tpci200-test.o CC tests/ipoctal232-test.o CC tests/display-vga-test.o CC tests/intel-hda-test.o CC tests/ivshmem-test.o CC tests/vmxnet3-test.o CC tests/pvpanic-test.o CC tests/i82801b11-test.o CC tests/ioh3420-test.o CC tests/usb-hcd-ohci-test.o CC tests/libqos/usb.o CC tests/usb-hcd-uhci-test.o CC tests/usb-hcd-ehci-test.o CC tests/usb-hcd-xhci-test.o CC tests/pc-cpu-test.o CC tests/q35-test.o CC tests/test-netfilter.o CC tests/test-filter-mirror.o CC tests/test-filter-redirector.o CC tests/postcopy-test.o CC tests/test-x86-cpuid-compat.o CC tests/device-introspect-test.o CC tests/qom-test.o LINK tests/check-qdict LINK tests/test-char LINK tests/check-qfloat LINK tests/check-qint LINK tests/check-qstring LINK tests/check-qlist LINK tests/check-qnull CC tests/test-qapi-visit.o CC tests/test-qapi-types.o LINK tests/check-qjson CC tests/test-qapi-event.o CC tests/test-qmp-introspect.o CC tests/test-qmp-marshal.o LINK tests/test-coroutine LINK tests/test-iov LINK tests/test-aio LINK tests/test-throttle LINK tests/test-thread-pool LINK tests/test-hbitmap LINK tests/test-blockjob LINK tests/test-blockjob-txn LINK tests/test-x86-cpuid LINK tests/test-xbzrle
libqemuutil.a(hbitmap.o): In function `hbitmap_sha256':/tmp/qemu-test/src/util/hbitmap.c:717: undefined reference to `qcrypto_hash_digest'
collect2: ld returned 1 exit status
make: *** [tests/test-hbitmap] Error 1
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes. Stop.
make[1]: *** [docker-run] Error 2
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-i0r8u2uq/src'
make: *** [docker-run-test-quick@centos6] Error 2
=== OUTPUT END ===
Test command exited with code: 2
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]