aboutsummaryrefslogtreecommitdiff
path: root/scsi/pr-manager.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 /scsi/pr-manager.c
parentc9db2b6489f7d04b5fd3288565cb163476a04dc1 (diff)
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/pr-manager.c')
-rw-r--r--scsi/pr-manager.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c
index 2a8f300dde..d9f4e8c3ad 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)