summaryrefslogtreecommitdiffstats
path: root/blockdev.c
diff options
context:
space:
mode:
authorKevin Wolf2019-04-25 14:25:10 +0200
committerKevin Wolf2019-06-04 15:22:22 +0200
commitd861ab3acf8dcf817e0c2335979b258847b69564 (patch)
tree9e334e6976355a7a262e3a9200354008195becfc /blockdev.c
parentblock: Add Error to blk_set_aio_context() (diff)
downloadqemu-d861ab3acf8dcf817e0c2335979b258847b69564.tar.gz
qemu-d861ab3acf8dcf817e0c2335979b258847b69564.tar.xz
qemu-d861ab3acf8dcf817e0c2335979b258847b69564.zip
block: Add BlockBackend.ctx
This adds a new parameter to blk_new() which requires its callers to declare from which AioContext this BlockBackend is going to be used (or the locks of which AioContext need to be taken anyway). The given context is only stored and kept up to date when changing AioContexts. Actually applying the stored AioContext to the root node is saved for another commit. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c
index d88dc115f2..e1ad92c559 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -574,7 +574,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
if ((!file || !*file) && !qdict_size(bs_opts)) {
BlockBackendRootState *blk_rs;
- blk = blk_new(0, BLK_PERM_ALL);
+ blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
blk_rs = blk_get_root_state(blk);
blk_rs->open_flags = bdrv_flags;
blk_rs->read_only = read_only;
@@ -3154,7 +3154,7 @@ void qmp_block_resize(bool has_device, const char *device,
goto out;
}
- blk = blk_new(BLK_PERM_RESIZE, BLK_PERM_ALL);
+ blk = blk_new(bdrv_get_aio_context(bs), BLK_PERM_RESIZE, BLK_PERM_ALL);
ret = blk_insert_bs(blk, bs, errp);
if (ret < 0) {
goto out;