Skip to contentSkip to conversation

block: Don't emulate natively supported pwritev flags

PATCH Applied Kevin Wolf 3 participants 4 messages Jun 7, 2016 – Jun 8, 2016 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Don't emulate natively supported pwritev flags

Drivers that implement .bdrv_co_pwritev() get the flags passed as an argument to said function, but we also unconditionally emulate the flags anyway. We shouldn't do that.

Fix this by clearing all flags that the driver supports natively after it returns from .bdrv_co_pwritev().

Fixes 4df863f3 ('block: Make supported_write_flags a per-bds property')
---
 block/io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/io.c +3 -1
index 2b10870..dec30e3 100644
@@ -816,7 +816,9 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
     int ret;
 
     if (drv->bdrv_co_pwritev) {
-        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov, flags);
+        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov,
+                                   flags & bs->supported_write_flags);
+        flags &= ~bs->supported_write_flags;
         goto emulate_flags;
     }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kevin Wolf

Drivers that implement .bdrv_co_pwritev() get the flags passed as an argument to said function, but we also unconditionally emulate the flags anyway. We shouldn't do that.

Quoted 9 lines

Fix this by clearing all flags that the driver supports natively after it returns from .bdrv_co_pwritev().

Fixes 4df863f3 ('block: Make supported_write_flags a per-bds property')
---
 block/io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 16 lines
block/io.c +3 -1
index 2b10870..dec30e3 100644
@@ -816,7 +816,9 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
     int ret;
 
     if (drv->bdrv_co_pwritev) {
-        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov, flags);
+        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov,
+                                   flags & bs->supported_write_flags);
+        flags &= ~bs->supported_write_flags;
         goto emulate_flags;
     }
 
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 4 lines · Kevin Wolf

Drivers that implement .bdrv_co_pwritev() get the flags passed as an argument to said function, but we also unconditionally emulate the flags anyway. We shouldn't do that.

Quoted 8 lines

Fix this by clearing all flags that the driver supports natively after it returns from .bdrv_co_pwritev().

Fixes 4df863f3 ('block: Make supported_write_flags a per-bds property')
---
 block/io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw
In reply to Kevin Wolf
Quoted 4 lines · Kevin Wolf

Drivers that implement .bdrv_co_pwritev() get the flags passed as an argument to said function, but we also unconditionally emulate the flags anyway. We shouldn't do that.

Quoted 8 lines

Fix this by clearing all flags that the driver supports natively after it returns from .bdrv_co_pwritev().

Fixes 4df863f3 ('block: Make supported_write_flags a per-bds property')
---
 block/io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan