aboutsummaryrefslogtreecommitdiff
path: root/scsi
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 /scsi
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 'scsi')
-rw-r--r--scsi/pr-manager.c21
-rw-r--r--scsi/trace-events2
2 files changed, 10 insertions, 13 deletions
diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c
index 2a8f300..d9f4e8c 100644
--- a/scsi/pr-manager.c
+++ b/scsi/pr-manager.c
@@ -48,24 +48,21 @@ static int pr_manager_worker(void *opaque)
}
-BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
- AioContext *ctx, int fd,
- struct sg_io_hdr *hdr,
- BlockCompletionFunc *complete,
- void *opaque)
+int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd,
+ struct sg_io_hdr *hdr)
{
- PRManagerData *data = g_new(PRManagerData, 1);
ThreadPool *pool = aio_get_thread_pool(ctx);
+ PRManagerData data = {
+ .pr_mgr = pr_mgr,
+ .fd = fd,
+ .hdr = hdr,
+ };
- trace_pr_manager_execute(fd, hdr->cmdp[0], hdr->cmdp[1], opaque);
- data->pr_mgr = pr_mgr;
- data->fd = fd;
- data->hdr = hdr;
+ trace_pr_manager_execute(fd, hdr->cmdp[0], hdr->cmdp[1]);
/* The matching object_unref is in pr_manager_worker. */
object_ref(OBJECT(pr_mgr));
- return thread_pool_submit_aio(pool, pr_manager_worker,
- data, complete, opaque);
+ return thread_pool_submit_co(pool, pr_manager_worker, &data);
}
bool pr_manager_is_connected(PRManager *pr_mgr)
diff --git a/scsi/trace-events b/scsi/trace-events
index 45f5b6e..f8a68b1 100644
--- a/scsi/trace-events
+++ b/scsi/trace-events
@@ -1,3 +1,3 @@
# scsi/pr-manager.c
-pr_manager_execute(int fd, int cmd, int sa, void *opaque) "fd=%d cmd=0x%02x service action=0x%02x opaque=%p"
+pr_manager_execute(int fd, int cmd, int sa) "fd=%d cmd=0x%02x service action=0x%02x"
pr_manager_run(int fd, int cmd, int sa) "fd=%d cmd=0x%02x service action=0x%02x"