diff mbox series

[3/5] block/qcow2-bitmap: don't remove bitmaps on reopen

Message ID 20190305234337.18353-4-jsnow@redhat.com
State New
Headers show
Series block/qcow2-bitmap: Enable resize with persistent bitmaps | expand

Commit Message

John Snow March 5, 2019, 11:43 p.m. UTC
We tend to remove bitmaps when we flush them to disk, but it's not appropriate
in all cases. let the reopen mechanism use the lighter weight flush instead of
the heavier store.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qcow2-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vladimir Sementsov-Ogievskiy March 6, 2019, 3:28 p.m. UTC | #1
06.03.2019 2:43, John Snow wrote:
> We tend to remove bitmaps when we flush them to disk, but it's not appropriate
> in all cases. let the reopen mechanism use the lighter weight flush instead of
> the heavier store.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   block/qcow2-bitmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
> index 4e11b6b05a..9373055d3b 100644
> --- a/block/qcow2-bitmap.c
> +++ b/block/qcow2-bitmap.c
> @@ -1560,7 +1560,7 @@ int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp)
>       BdrvDirtyBitmap *bitmap;
>       Error *local_err = NULL;
>   
> -    qcow2_store_persistent_dirty_bitmaps(bs, &local_err);
> +    qcow2_flush_persistent_dirty_bitmaps(bs, &local_err);
>       if (local_err != NULL) {
>           error_propagate(errp, local_err);
>           return -EINVAL;
> 


hmm will it work? if we call qcow2_open after that, it will fail to load bitmaps, as they
are already exist
John Snow March 6, 2019, 3:38 p.m. UTC | #2
On 3/6/19 10:28 AM, Vladimir Sementsov-Ogievskiy wrote:
> 06.03.2019 2:43, John Snow wrote:
>> We tend to remove bitmaps when we flush them to disk, but it's not appropriate
>> in all cases. let the reopen mechanism use the lighter weight flush instead of
>> the heavier store.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>   block/qcow2-bitmap.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
>> index 4e11b6b05a..9373055d3b 100644
>> --- a/block/qcow2-bitmap.c
>> +++ b/block/qcow2-bitmap.c
>> @@ -1560,7 +1560,7 @@ int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp)
>>       BdrvDirtyBitmap *bitmap;
>>       Error *local_err = NULL;
>>   
>> -    qcow2_store_persistent_dirty_bitmaps(bs, &local_err);
>> +    qcow2_flush_persistent_dirty_bitmaps(bs, &local_err);
>>       if (local_err != NULL) {
>>           error_propagate(errp, local_err);
>>           return -EINVAL;
>>
> 
> 
> hmm will it work? if we call qcow2_open after that, it will fail to load bitmaps, as they
> are already exist
> 

Hmm, maybe you're right. I didn't test this very well. It seemed wrong
to me so I "fixed" it... let me write a test that covers this.
diff mbox series

Patch

diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 4e11b6b05a..9373055d3b 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -1560,7 +1560,7 @@  int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp)
     BdrvDirtyBitmap *bitmap;
     Error *local_err = NULL;
 
-    qcow2_store_persistent_dirty_bitmaps(bs, &local_err);
+    qcow2_flush_persistent_dirty_bitmaps(bs, &local_err);
     if (local_err != NULL) {
         error_propagate(errp, local_err);
         return -EINVAL;