diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-11-14 16:56:10 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-06-26 14:51:14 +0200 |
commit | 0f21b7a1b7163dddfe7900bd3da7b4cf9568b536 (patch) | |
tree | 243a8ba1d7148643d64535c25b61165f1d772d3e /block/qed.c | |
parent | a8165d2d6619a29b99451fd0a310d64693d86c3f (diff) | |
download | qemu-0f21b7a1b7163dddfe7900bd3da7b4cf9568b536.zip qemu-0f21b7a1b7163dddfe7900bd3da7b4cf9568b536.tar.gz qemu-0f21b7a1b7163dddfe7900bd3da7b4cf9568b536.tar.bz2 |
qed: Remove callback from qed_find_cluster()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/qed.c')
-rw-r--r-- | block/qed.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/block/qed.c b/block/qed.c index a837a28..290cbcd 100644 --- a/block/qed.c +++ b/block/qed.c @@ -776,14 +776,14 @@ static int64_t coroutine_fn bdrv_qed_co_get_block_status(BlockDriverState *bs, .file = file, }; QEDRequest request = { .l2_table = NULL }; + uint64_t offset; + int ret; - qed_find_cluster(s, &request, cb.pos, len, qed_is_allocated_cb, &cb); + ret = qed_find_cluster(s, &request, cb.pos, &len, &offset); + qed_is_allocated_cb(&cb, ret, offset, len); - /* Now sleep if the callback wasn't invoked immediately */ - while (cb.status == BDRV_BLOCK_OFFSET_MASK) { - cb.co = qemu_coroutine_self(); - qemu_coroutine_yield(); - } + /* The callback was invoked immediately */ + assert(cb.status != BDRV_BLOCK_OFFSET_MASK); qed_unref_l2_cache_entry(request.l2_table); @@ -1306,8 +1306,6 @@ static void qed_aio_write_inplace(QEDAIOCB *acb, uint64_t offset, size_t len) * or -errno * @offset: Cluster offset in bytes * @len: Length in bytes - * - * Callback from qed_find_cluster(). */ static void qed_aio_write_data(void *opaque, int ret, uint64_t offset, size_t len) @@ -1343,8 +1341,6 @@ static void qed_aio_write_data(void *opaque, int ret, * or -errno * @offset: Cluster offset in bytes * @len: Length in bytes - * - * Callback from qed_find_cluster(). */ static void qed_aio_read_data(void *opaque, int ret, uint64_t offset, size_t len) @@ -1393,6 +1389,8 @@ static void qed_aio_next_io(QEDAIOCB *acb, int ret) BDRVQEDState *s = acb_to_s(acb); QEDFindClusterFunc *io_fn = (acb->flags & QED_AIOCB_WRITE) ? qed_aio_write_data : qed_aio_read_data; + uint64_t offset; + size_t len; trace_qed_aio_next_io(s, acb, ret, acb->cur_pos + acb->cur_qiov.size); @@ -1419,9 +1417,9 @@ static void qed_aio_next_io(QEDAIOCB *acb, int ret) } /* Find next cluster and start I/O */ - qed_find_cluster(s, &acb->request, - acb->cur_pos, acb->end_pos - acb->cur_pos, - io_fn, acb); + len = acb->end_pos - acb->cur_pos; + ret = qed_find_cluster(s, &acb->request, acb->cur_pos, &len, &offset); + io_fn(acb, ret, offset, len); } static BlockAIOCB *qed_aio_setup(BlockDriverState *bs, |