aboutsummaryrefslogtreecommitdiff
path: root/block/file-posix.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-10-31 11:25:18 +0100
committerKevin Wolf <kwolf@redhat.com>2018-12-14 11:52:41 +0100
commit2f3a7ab39bec4ba8022dc4d42ea641165b004e3e (patch)
tree9811e2150001abef54d55c9a2d545ca7f1903f13 /block/file-posix.c
parentc9db2b6489f7d04b5fd3288565cb163476a04dc1 (diff)
downloadqemu-2f3a7ab39bec4ba8022dc4d42ea641165b004e3e.zip
qemu-2f3a7ab39bec4ba8022dc4d42ea641165b004e3e.tar.gz
qemu-2f3a7ab39bec4ba8022dc4d42ea641165b004e3e.tar.bz2
file-posix: Switch to .bdrv_co_ioctl
No real reason to keep using the callback based mechanism here when the rest of the file-posix driver is coroutine based. Changing it brings ioctls more in line with how other request types work. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/file-posix.c')
-rw-r--r--block/file-posix.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/block/file-posix.c b/block/file-posix.c
index c8a085a..9c15bbe 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -3109,24 +3109,25 @@ hdev_open_Mac_error:
}
#if defined(__linux__)
-
-static BlockAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
- unsigned long int req, void *buf,
- BlockCompletionFunc *cb, void *opaque)
+static int coroutine_fn
+hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
{
BDRVRawState *s = bs->opaque;
RawPosixAIOData *acb;
ThreadPool *pool;
+ int ret;
- if (fd_open(bs) < 0)
- return NULL;
+ ret = fd_open(bs);
+ if (ret < 0) {
+ return ret;
+ }
if (req == SG_IO && s->pr_mgr) {
struct sg_io_hdr *io_hdr = buf;
if (io_hdr->cmdp[0] == PERSISTENT_RESERVE_OUT ||
io_hdr->cmdp[0] == PERSISTENT_RESERVE_IN) {
return pr_manager_execute(s->pr_mgr, bdrv_get_aio_context(bs),
- s->fd, io_hdr, cb, opaque);
+ s->fd, io_hdr);
}
}
@@ -3138,7 +3139,7 @@ static BlockAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
acb->ioctl.buf = buf;
acb->ioctl.cmd = req;
pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
- return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque);
+ return thread_pool_submit_co(pool, aio_worker, acb);
}
#endif /* linux */
@@ -3279,7 +3280,7 @@ static BlockDriver bdrv_host_device = {
/* generic scsi device */
#ifdef __linux__
- .bdrv_aio_ioctl = hdev_aio_ioctl,
+ .bdrv_co_ioctl = hdev_co_ioctl,
#endif
};
@@ -3401,7 +3402,7 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_lock_medium = cdrom_lock_medium,
/* generic scsi device */
- .bdrv_aio_ioctl = hdev_aio_ioctl,
+ .bdrv_co_ioctl = hdev_co_ioctl,
};
#endif /* __linux__ */