diff mbox series

[v9,2/9] blkverify: set supported write/zero flags

Message ID 1525791496-125188-3-git-send-email-anton.nefedov@virtuozzo.com
State New
Headers show
Series qcow2: cluster space preallocation | expand

Commit Message

Anton Nefedov May 8, 2018, 2:58 p.m. UTC
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
 block/blkverify.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eric Blake May 15, 2018, 2:37 p.m. UTC | #1
On 05/08/2018 09:58 AM, Anton Nefedov wrote:
> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> ---
>   block/blkverify.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/block/blkverify.c b/block/blkverify.c
> index 754cc9e..496ae09 100644
> --- a/block/blkverify.c
> +++ b/block/blkverify.c
> @@ -141,6 +141,15 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
>           goto fail;
>       }
>   
> +    bs->supported_write_flags = BDRV_REQ_FUA &
> +        bs->file->bs->supported_write_flags &
> +        s->test_file->bs->supported_write_flags;

I wonder if it's worth the effort to support the flags if the main file 
supports them natively but the test_file does not (and just emulate the 
flag on the test file, in that situation).  But for now, I'm fine with 
your choice that both files must support a flag before the blkverify 
layer claims the flag as well.

> +
> +    bs->supported_zero_flags =
> +        (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
> +        bs->file->bs->supported_zero_flags &
> +        s->test_file->bs->supported_zero_flags;
> +
>       ret = 0;
>   fail:
>       qemu_opts_del(opts);
>
diff mbox series

Patch

diff --git a/block/blkverify.c b/block/blkverify.c
index 754cc9e..496ae09 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -141,6 +141,15 @@  static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
 
+    bs->supported_write_flags = BDRV_REQ_FUA &
+        bs->file->bs->supported_write_flags &
+        s->test_file->bs->supported_write_flags;
+
+    bs->supported_zero_flags =
+        (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+        bs->file->bs->supported_zero_flags &
+        s->test_file->bs->supported_zero_flags;
+
     ret = 0;
 fail:
     qemu_opts_del(opts);