aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2018-04-24 17:01:57 -0500
committerKevin Wolf <kwolf@redhat.com>2018-05-15 16:11:41 +0200
commite18a58b4e3aa355a9b6eef1f39a980a4f18f1294 (patch)
tree146a95a5e75593be186f02dceef82ca8c86bee28 /block/io.c
parentedfab6a08b0dc240ac3a665adf4dc40db9b9ec7f (diff)
downloadqemu-e18a58b4e3aa355a9b6eef1f39a980a4f18f1294.zip
qemu-e18a58b4e3aa355a9b6eef1f39a980a4f18f1294.tar.gz
qemu-e18a58b4e3aa355a9b6eef1f39a980a4f18f1294.tar.bz2
block: Merge .bdrv_co_writev{,_flags} in drivers
We have too many driver callback interfaces; simplify the mess somewhat by merging the flags parameter of .bdrv_co_writev_flags() into .bdrv_co_writev(). Note that as long as a driver doesn't set .supported_write_flags, the flags argument will be 0 and behavior is identical. Also note that the public function bdrv_co_writev() still lacks a flags argument; so the driver signature is thus intentionally slightly different. But that's not the end of the world, nor the first time that the driver interface differs slightly from the public interface. Ideally, we should be rewriting all of these drivers to use modern byte-based interfaces. But that's a more invasive patch to write and audit, compared to the simplification done here. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/block/io.c b/block/io.c
index 6b110b2..4fad5ac 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1000,15 +1000,10 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
- if (drv->bdrv_co_writev_flags) {
- ret = drv->bdrv_co_writev_flags(bs, sector_num, nb_sectors, qiov,
- flags & bs->supported_write_flags);
- flags &= ~bs->supported_write_flags;
- } else {
- assert(drv->bdrv_co_writev);
- assert(!bs->supported_write_flags);
- ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
- }
+ assert(drv->bdrv_co_writev);
+ ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov,
+ flags & bs->supported_write_flags);
+ flags &= ~bs->supported_write_flags;
emulate_flags:
if (ret == 0 && (flags & BDRV_REQ_FUA)) {