diff mbox

[v8,1/9] mirror: inherit supported write/zero flags

Message ID 1520849818-6915-2-git-send-email-anton.nefedov@virtuozzo.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anton Nefedov March 12, 2018, 10:16 a.m. UTC
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
---
 block/mirror.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alberto Garcia March 16, 2018, 10:35 a.m. UTC | #1
On Mon 12 Mar 2018 11:16:50 AM CET, Anton Nefedov wrote:
> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
> ---
>  block/mirror.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index f5bf620..2fb786f 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1100,6 +1100,15 @@ static BlockDriver bdrv_mirror_top = {
>      .bdrv_child_perm            = bdrv_mirror_top_child_perm,
>  };
>  
> +static void mirror_top_set_supported_flags(BlockDriverState *bs)
> +{
> +    bs->supported_write_flags = BDRV_REQ_FUA &
> +        bs->backing->bs->supported_write_flags;
> +    bs->supported_zero_flags =
> +        (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
> +        bs->backing->bs->supported_zero_flags;
> +}
> +

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto
diff mbox

Patch

diff --git a/block/mirror.c b/block/mirror.c
index f5bf620..2fb786f 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1100,6 +1100,15 @@  static BlockDriver bdrv_mirror_top = {
     .bdrv_child_perm            = bdrv_mirror_top_child_perm,
 };
 
+static void mirror_top_set_supported_flags(BlockDriverState *bs)
+{
+    bs->supported_write_flags = BDRV_REQ_FUA &
+        bs->backing->bs->supported_write_flags;
+    bs->supported_zero_flags =
+        (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+        bs->backing->bs->supported_zero_flags;
+}
+
 static void mirror_start_job(const char *job_id, BlockDriverState *bs,
                              int creation_flags, BlockDriverState *target,
                              const char *replaces, int64_t speed,
@@ -1165,6 +1174,8 @@  static void mirror_start_job(const char *job_id, BlockDriverState *bs,
         return;
     }
 
+    mirror_top_set_supported_flags(mirror_top_bs);
+
     /* Make sure that the source is not resized while the job is running */
     s = block_job_create(job_id, driver, mirror_top_bs,
                          BLK_PERM_CONSISTENT_READ,