diff mbox series

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

Message ID 20181203101429.88735-2-anton.nefedov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series qcow2: cluster space preallocation | expand

Commit Message

Anton Nefedov Dec. 3, 2018, 10:14 a.m. UTC
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
---
 block/mirror.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Vladimir Sementsov-Ogievskiy Dec. 5, 2018, 12:43 p.m. UTC | #1
Could you please write, what is the behavior change and why here?

Is it a bug, that FUA was not inherited before?

03.12.2018 13:14, Anton Nefedov wrote:
> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
> ---
>   block/mirror.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/block/mirror.c b/block/mirror.c
> index 56d9ef7474..56908c9b19 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1528,8 +1528,12 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
>           mirror_top_bs->implicit = true;
>       }
>       mirror_top_bs->total_sectors = bs->total_sectors;
> -    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
> -    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
> +    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
> +        (BDRV_REQ_FUA & bs->supported_write_flags);
> +    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
> +        ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP)
> +         & bs->supported_zero_flags);
> +
>       bs_opaque = g_new0(MirrorBDSOpaque, 1);
>       mirror_top_bs->opaque = bs_opaque;
>       bdrv_set_aio_context(mirror_top_bs, bdrv_get_aio_context(bs));
>
Anton Nefedov Dec. 5, 2018, 1:27 p.m. UTC | #2
On 5/12/2018 3:43 PM, Vladimir Sementsov-Ogievskiy wrote:
> Could you please write, what is the behavior change and why here?
> 

The idea is that passthrough drivers should report the flags if there
are no obstacles to support it.
Technically, these changes are not connected to this series, but since
BDRV_REQ_ALLOCATE flag is added, so we might want to expose it where
possible.

> Is it a bug, that FUA was not inherited before?
> 

I don't think it's a bug really since there is a fallback path in
block/io.c.

> 03.12.2018 13:14, Anton Nefedov wrote:
>> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
>> ---
>>    block/mirror.c | 8 ++++++--
>>    1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/mirror.c b/block/mirror.c
>> index 56d9ef7474..56908c9b19 100644
>> --- a/block/mirror.c
>> +++ b/block/mirror.c
>> @@ -1528,8 +1528,12 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
>>            mirror_top_bs->implicit = true;
>>        }
>>        mirror_top_bs->total_sectors = bs->total_sectors;
>> -    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
>> -    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
>> +    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
>> +        (BDRV_REQ_FUA & bs->supported_write_flags);
>> +    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
>> +        ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP)
>> +         & bs->supported_zero_flags);
>> +
>>        bs_opaque = g_new0(MirrorBDSOpaque, 1);
>>        mirror_top_bs->opaque = bs_opaque;
>>        bdrv_set_aio_context(mirror_top_bs, bdrv_get_aio_context(bs));
>>
> 
>
Alberto Garcia Dec. 7, 2018, 2:31 p.m. UTC | #3
On Mon 03 Dec 2018 11:14:53 AM CET, Anton Nefedov wrote:
> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>

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

Berto
Vladimir Sementsov-Ogievskiy Dec. 12, 2018, 12:15 p.m. UTC | #4
03.12.2018 13:14, Anton Nefedov wrote:
> Signed-off-by: Anton Nefedov<anton.nefedov@virtuozzo.com>

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

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 56d9ef7474..56908c9b19 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1528,8 +1528,12 @@  static void mirror_start_job(const char *job_id, BlockDriverState *bs,
         mirror_top_bs->implicit = true;
     }
     mirror_top_bs->total_sectors = bs->total_sectors;
-    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
-    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
+    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
+        (BDRV_REQ_FUA & bs->supported_write_flags);
+    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
+        ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP)
+         & bs->supported_zero_flags);
+
     bs_opaque = g_new0(MirrorBDSOpaque, 1);
     mirror_top_bs->opaque = bs_opaque;
     bdrv_set_aio_context(mirror_top_bs, bdrv_get_aio_context(bs));