[Qemu-devel] [PATCH 2/3] vmdk: Make block_status recurse for flat extents

Max Reitz posted 3 patches 6 years, 6 months ago
Maintainers: Max Reitz <mreitz@redhat.com>, Stefan Weil <sw@weilnetz.de>, Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>
[Qemu-devel] [PATCH 2/3] vmdk: Make block_status recurse for flat extents
Posted by Max Reitz 6 years, 6 months ago
Fixes: 69f47505ee66afaa513305de0c1895a224e52c45
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/vmdk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index bd36ece125..fd78fd0ccf 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1692,6 +1692,9 @@ static int coroutine_fn vmdk_co_block_status(BlockDriverState *bs,
         if (!extent->compressed) {
             ret |= BDRV_BLOCK_OFFSET_VALID;
             *map = cluster_offset + index_in_cluster;
+            if (extent->flat) {
+                ret |= BDRV_BLOCK_RECURSE;
+            }
         }
         *file = extent->file->bs;
         break;
-- 
2.21.0


Re: [Qemu-devel] [PATCH 2/3] vmdk: Make block_status recurse for flat extents
Posted by Vladimir Sementsov-Ogievskiy 6 years, 6 months ago
25.07.2019 18:55, Max Reitz wrote:
> Fixes: 69f47505ee66afaa513305de0c1895a224e52c45
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Again, don't know vmdk code, but briefly looking at it (and at vmdk spec) I
see that "extents" are files, and flat extent is a raw file without any special
format. And it is allocated by blk_truncate(.. PREALLOC_MODE_OFF ..), so really
looks like metadata preallocation.

And, any way, there should not be real damage, as patch simply brings back old behavior
for one case.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   block/vmdk.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index bd36ece125..fd78fd0ccf 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1692,6 +1692,9 @@ static int coroutine_fn vmdk_co_block_status(BlockDriverState *bs,
>           if (!extent->compressed) {
>               ret |= BDRV_BLOCK_OFFSET_VALID;
>               *map = cluster_offset + index_in_cluster;
> +            if (extent->flat) {
> +                ret |= BDRV_BLOCK_RECURSE;
> +            }
>           }
>           *file = extent->file->bs;
>           break;
> 


-- 
Best regards,
Vladimir