* [PATCH] qcow2: set bdi->is_dirty
@ 2021-05-04 16:06 Vladimir Sementsov-Ogievskiy
2021-05-04 16:20 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2021-05-04 16:06 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, mreitz, kwolf, vsementsov, den, ktkhai
Set bdi->is_dirty, so that qemu-img info could show dirty flag.
After this commit the following check will show '"dirty-flag": true':
./build/qemu-img create -f qcow2 -o lazy_refcounts=on x 1M
./build/qemu-io x
qemu-io> write 0 1M
After "write" command success, kill the qemu-io process:
kill -9 <qemu-io pid>
./build/qemu-img info --output=json x
This will show '"dirty-flag": true' among other things. (before this
commit it shows '"dirty-flag": false')
Note, that qcow2's dirty-bit is not a "dirty bit for the image". It
only protects qcow2 lazy refcounts feature. So, there are a lot of
conditions when qcow2 session may be not closed correctly, but bit is
0. Still, when bit is set, the last session is definitely not finished
correctly and it's better to report it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/qcow2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index 9727ae8fe3..39b91ef940 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -5089,6 +5089,7 @@ static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
BDRVQcow2State *s = bs->opaque;
bdi->cluster_size = s->cluster_size;
bdi->vm_state_offset = qcow2_vm_state_offset(s);
+ bdi->is_dirty = s->incompatible_features & QCOW2_INCOMPAT_DIRTY;
return 0;
}
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] qcow2: set bdi->is_dirty
2021-05-04 16:06 [PATCH] qcow2: set bdi->is_dirty Vladimir Sementsov-Ogievskiy
@ 2021-05-04 16:20 ` Eric Blake
2021-05-04 16:58 ` Kirill Tkhai
2021-05-05 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2021-05-04 16:20 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, qemu-block
Cc: kwolf, den, ktkhai, qemu-devel, mreitz
On 5/4/21 11:06 AM, Vladimir Sementsov-Ogievskiy wrote:
> Set bdi->is_dirty, so that qemu-img info could show dirty flag.
>
> After this commit the following check will show '"dirty-flag": true':
>
> ./build/qemu-img create -f qcow2 -o lazy_refcounts=on x 1M
> ./build/qemu-io x
> qemu-io> write 0 1M
>
> After "write" command success, kill the qemu-io process:
>
> kill -9 <qemu-io pid>
>
> ./build/qemu-img info --output=json x
>
> This will show '"dirty-flag": true' among other things. (before this
> commit it shows '"dirty-flag": false')
>
> Note, that qcow2's dirty-bit is not a "dirty bit for the image". It
> only protects qcow2 lazy refcounts feature. So, there are a lot of
> conditions when qcow2 session may be not closed correctly, but bit is
> 0. Still, when bit is set, the last session is definitely not finished
> correctly and it's better to report it.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> block/qcow2.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] qcow2: set bdi->is_dirty
2021-05-04 16:06 [PATCH] qcow2: set bdi->is_dirty Vladimir Sementsov-Ogievskiy
2021-05-04 16:20 ` Eric Blake
@ 2021-05-04 16:58 ` Kirill Tkhai
2021-05-05 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Kirill Tkhai @ 2021-05-04 16:58 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, qemu-block; +Cc: qemu-devel, mreitz, kwolf, den
On 04.05.2021 19:06, Vladimir Sementsov-Ogievskiy wrote:
> Set bdi->is_dirty, so that qemu-img info could show dirty flag.
>
> After this commit the following check will show '"dirty-flag": true':
>
> ./build/qemu-img create -f qcow2 -o lazy_refcounts=on x 1M
> ./build/qemu-io x
> qemu-io> write 0 1M
>
> After "write" command success, kill the qemu-io process:
>
> kill -9 <qemu-io pid>
>
> ./build/qemu-img info --output=json x
>
> This will show '"dirty-flag": true' among other things. (before this
> commit it shows '"dirty-flag": false')
>
> Note, that qcow2's dirty-bit is not a "dirty bit for the image". It
> only protects qcow2 lazy refcounts feature. So, there are a lot of
> conditions when qcow2 session may be not closed correctly, but bit is
> 0. Still, when bit is set, the last session is definitely not finished
> correctly and it's better to report it.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Works for me. Thanks,
Tested-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> ---
> block/qcow2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 9727ae8fe3..39b91ef940 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -5089,6 +5089,7 @@ static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
> BDRVQcow2State *s = bs->opaque;
> bdi->cluster_size = s->cluster_size;
> bdi->vm_state_offset = qcow2_vm_state_offset(s);
> + bdi->is_dirty = s->incompatible_features & QCOW2_INCOMPAT_DIRTY;
> return 0;
> }
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] qcow2: set bdi->is_dirty
2021-05-04 16:06 [PATCH] qcow2: set bdi->is_dirty Vladimir Sementsov-Ogievskiy
2021-05-04 16:20 ` Eric Blake
2021-05-04 16:58 ` Kirill Tkhai
@ 2021-05-05 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2021-05-05 10:10 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy; +Cc: den, ktkhai, qemu-devel, qemu-block, mreitz
Am 04.05.2021 um 18:06 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Set bdi->is_dirty, so that qemu-img info could show dirty flag.
>
> After this commit the following check will show '"dirty-flag": true':
>
> ./build/qemu-img create -f qcow2 -o lazy_refcounts=on x 1M
> ./build/qemu-io x
> qemu-io> write 0 1M
>
> After "write" command success, kill the qemu-io process:
>
> kill -9 <qemu-io pid>
>
> ./build/qemu-img info --output=json x
>
> This will show '"dirty-flag": true' among other things. (before this
> commit it shows '"dirty-flag": false')
>
> Note, that qcow2's dirty-bit is not a "dirty bit for the image". It
> only protects qcow2 lazy refcounts feature. So, there are a lot of
> conditions when qcow2 session may be not closed correctly, but bit is
> 0. Still, when bit is set, the last session is definitely not finished
> correctly and it's better to report it.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-05 10:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 16:06 [PATCH] qcow2: set bdi->is_dirty Vladimir Sementsov-Ogievskiy
2021-05-04 16:20 ` Eric Blake
2021-05-04 16:58 ` Kirill Tkhai
2021-05-05 10:10 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.