summaryrefslogtreecommitdiff
path: root/block/qed.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-03-01 17:36:19 +0100
committerKevin Wolf <kwolf@redhat.com>2018-03-09 15:17:47 +0100
commit2fd6163884d74e74dd1ef54ab229d15c61d0b4cb (patch)
tree42dd511fe872ce7489ac3768ffc9522d7759191c /block/qed.c
parent2b148f392b2bfeba76d3e6d9607c3bd072350e8c (diff)
block: convert bdrv_check callback to coroutine_fn
Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1516279431-30424-8-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qed.c')
-rw-r--r--block/qed.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/block/qed.c b/block/qed.c
index 5a5414bfc3..5e6a6bfaa0 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1544,12 +1544,17 @@ static void coroutine_fn bdrv_qed_co_invalidate_cache(BlockDriverState *bs,
}
}
-static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result,
- BdrvCheckMode fix)
+static int bdrv_qed_co_check(BlockDriverState *bs, BdrvCheckResult *result,
+ BdrvCheckMode fix)
{
BDRVQEDState *s = bs->opaque;
+ int ret;
- return qed_check(s, result, !!fix);
+ qemu_co_mutex_lock(&s->table_lock);
+ ret = qed_check(s, result, !!fix);
+ qemu_co_mutex_unlock(&s->table_lock);
+
+ return ret;
}
static QemuOptsList qed_create_opts = {
@@ -1609,7 +1614,7 @@ static BlockDriver bdrv_qed = {
.bdrv_refresh_limits = bdrv_qed_refresh_limits,
.bdrv_change_backing_file = bdrv_qed_change_backing_file,
.bdrv_co_invalidate_cache = bdrv_qed_co_invalidate_cache,
- .bdrv_check = bdrv_qed_check,
+ .bdrv_co_check = bdrv_qed_co_check,
.bdrv_detach_aio_context = bdrv_qed_detach_aio_context,
.bdrv_attach_aio_context = bdrv_qed_attach_aio_context,
.bdrv_co_drain_begin = bdrv_qed_co_drain_begin,