open_failed:
bs->drv = NULL;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
if (bs->file != NULL) {
bdrv_unref_child(bs, bs->file);
assert(!bs->file);
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
g_free(bs->opaque);
bs->opaque = NULL;
bdrv_ref(drain_bs);
bdrv_drained_begin(drain_bs);
- bdrv_graph_wrlock(backing_hd);
+ bdrv_graph_wrlock();
ret = bdrv_set_backing_hd_drained(bs, backing_hd, errp);
- bdrv_graph_wrunlock(backing_hd);
+ bdrv_graph_wrunlock();
bdrv_drained_end(drain_bs);
bdrv_unref(drain_bs);
return NULL;
}
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
ctx = bdrv_get_aio_context(bs);
aio_context_acquire(ctx);
child = bdrv_attach_child(parent, bs, bdref_key, child_class, child_role,
errp);
aio_context_release(ctx);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
return child;
}
aio_context_release(ctx);
}
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
tran_commit(tran);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) {
BlockDriverState *bs = bs_entry->state.bs;
goto cleanup;
abort:
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
tran_abort(tran);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
if (bs_entry->prepared) {
}
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(new_child_bs);
+ bdrv_graph_wrlock();
ret = bdrv_set_file_or_backing_noperm(bs, new_child_bs, is_backing,
tran, errp);
- bdrv_graph_wrunlock_ctx(ctx);
+ bdrv_graph_wrunlock();
if (old_ctx != ctx) {
aio_context_release(ctx);
bs->drv = NULL;
}
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
bdrv_unref_child(bs, child);
}
assert(!bs->backing);
assert(!bs->file);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
g_free(bs->opaque);
bs->opaque = NULL;
bdrv_graph_rdunlock_main_loop();
bdrv_drained_begin(child_bs);
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
ret = bdrv_replace_node_common(bs, child_bs, true, true, errp);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(child_bs);
return ret;
aio_context_acquire(old_context);
new_context = NULL;
- bdrv_graph_wrlock(bs_top);
+ bdrv_graph_wrlock();
child = bdrv_attach_child_noperm(bs_new, bs_top, "backing",
&child_of_bds, bdrv_backing_role(bs_new),
tran_finalize(tran, ret);
bdrv_refresh_limits(bs_top, NULL, NULL);
- bdrv_graph_wrunlock(bs_top);
+ bdrv_graph_wrunlock();
bdrv_drained_end(bs_top);
bdrv_drained_end(bs_new);
bdrv_ref(old_bs);
bdrv_drained_begin(old_bs);
bdrv_drained_begin(new_bs);
- bdrv_graph_wrlock(new_bs);
+ bdrv_graph_wrlock();
bdrv_replace_child_tran(child, new_bs, tran);
tran_finalize(tran, ret);
- bdrv_graph_wrunlock(new_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(old_bs);
bdrv_drained_end(new_bs);
bdrv_unref(old_bs);
bdrv_ref(bs);
bdrv_drained_begin(bs);
bdrv_drained_begin(new_node_bs);
- bdrv_graph_wrlock(new_node_bs);
+ bdrv_graph_wrlock();
ret = bdrv_replace_node(bs, new_node_bs, errp);
- bdrv_graph_wrunlock(new_node_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(new_node_bs);
bdrv_drained_end(bs);
bdrv_unref(bs);
bdrv_ref(top);
bdrv_drained_begin(base);
- bdrv_graph_wrlock(base);
+ bdrv_graph_wrlock();
if (!top->drv || !base->drv) {
goto exit_wrlock;
* That's a FIXME.
*/
bdrv_replace_node_common(top, base, false, false, &local_err);
- bdrv_graph_wrunlock(base);
+ bdrv_graph_wrunlock();
if (local_err) {
error_report_err(local_err);
goto exit;
exit_wrlock:
- bdrv_graph_wrunlock(base);
+ bdrv_graph_wrunlock();
exit:
bdrv_drained_end(base);
bdrv_unref(top);
block_copy_set_speed(bcs, speed);
/* Required permissions are taken by copy-before-write filter target */
- bdrv_graph_wrlock(target);
+ bdrv_graph_wrlock();
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
&error_abort);
- bdrv_graph_wrunlock(target);
+ bdrv_graph_wrunlock();
return &job->common;
ret = 0;
fail_log:
if (ret < 0) {
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, s->log_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
s->log_file = NULL;
}
fail:
{
BDRVBlkLogWritesState *s = bs->opaque;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, s->log_file);
s->log_file = NULL;
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
}
static int64_t coroutine_fn GRAPH_RDLOCK
{
BDRVBlkverifyState *s = bs->opaque;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, s->test_file);
s->test_file = NULL;
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
}
static int64_t coroutine_fn GRAPH_RDLOCK
{
ThrottleGroupMember *tgm = &blk->public.throttle_group_member;
BdrvChild *root;
- AioContext *ctx;
GLOBAL_STATE_CODE();
root = blk->root;
blk->root = NULL;
- ctx = bdrv_get_aio_context(root->bs);
- bdrv_graph_wrlock(root->bs);
+ bdrv_graph_wrlock();
bdrv_root_unref_child(root);
- bdrv_graph_wrunlock_ctx(ctx);
+ bdrv_graph_wrunlock();
}
/*
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp)
{
ThrottleGroupMember *tgm = &blk->public.throttle_group_member;
- AioContext *ctx = bdrv_get_aio_context(bs);
GLOBAL_STATE_CODE();
bdrv_ref(bs);
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
blk->root = bdrv_root_attach_child(bs, "root", &child_root,
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
blk->perm, blk->shared_perm,
blk, errp);
- bdrv_graph_wrunlock_ctx(ctx);
+ bdrv_graph_wrunlock();
if (blk->root == NULL) {
return -EPERM;
}
bdrv_graph_rdunlock_main_loop();
bdrv_drained_begin(commit_top_backing_bs);
- bdrv_graph_wrlock(commit_top_backing_bs);
+ bdrv_graph_wrlock();
bdrv_replace_node(s->commit_top_bs, commit_top_backing_bs, &error_abort);
- bdrv_graph_wrunlock(commit_top_backing_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(commit_top_backing_bs);
bdrv_unref(s->commit_top_bs);
* this is the responsibility of the interface (i.e. whoever calls
* commit_start()).
*/
- bdrv_graph_wrlock(top);
+ bdrv_graph_wrlock();
s->base_overlay = bdrv_find_overlay(top, base);
assert(s->base_overlay);
ret = block_job_add_bdrv(&s->common, "intermediate node", iter, 0,
iter_shared_perms, errp);
if (ret < 0) {
- bdrv_graph_wrunlock(top);
+ bdrv_graph_wrunlock();
goto fail;
}
}
if (bdrv_freeze_backing_chain(commit_top_bs, base, errp) < 0) {
- bdrv_graph_wrunlock(top);
+ bdrv_graph_wrunlock();
goto fail;
}
s->chain_frozen = true;
ret = block_job_add_bdrv(&s->common, "base", base, 0, BLK_PERM_ALL, errp);
- bdrv_graph_wrunlock(top);
+ bdrv_graph_wrunlock();
if (ret < 0) {
goto fail;
* otherwise this would fail because of lack of permissions. */
if (commit_top_bs) {
bdrv_drained_begin(top);
- bdrv_graph_wrlock(top);
+ bdrv_graph_wrlock();
bdrv_replace_node(commit_top_bs, top, &error_abort);
- bdrv_graph_wrunlock(top);
+ bdrv_graph_wrunlock();
bdrv_drained_end(top);
}
}
return rd;
}
-void no_coroutine_fn bdrv_graph_wrlock(BlockDriverState *bs)
+void no_coroutine_fn bdrv_graph_wrlock(void)
{
- AioContext *ctx = NULL;
-
GLOBAL_STATE_CODE();
assert(!qatomic_read(&has_writer));
assert(!qemu_in_coroutine());
- /*
- * Release only non-mainloop AioContext. The mainloop often relies on the
- * BQL and doesn't lock the main AioContext before doing things.
- */
- if (bs) {
- ctx = bdrv_get_aio_context(bs);
- if (ctx != qemu_get_aio_context()) {
- aio_context_release(ctx);
- } else {
- ctx = NULL;
- }
- }
-
/* Make sure that constantly arriving new I/O doesn't cause starvation */
bdrv_drain_all_begin_nopoll();
} while (reader_count() >= 1);
bdrv_drain_all_end();
-
- if (ctx) {
- aio_context_acquire(bdrv_get_aio_context(bs));
- }
}
-void no_coroutine_fn bdrv_graph_wrunlock_ctx(AioContext *ctx)
+void no_coroutine_fn bdrv_graph_wrunlock(void)
{
GLOBAL_STATE_CODE();
assert(qatomic_read(&has_writer));
- /*
- * Release only non-mainloop AioContext. The mainloop often relies on the
- * BQL and doesn't lock the main AioContext before doing things.
- */
- if (ctx && ctx != qemu_get_aio_context()) {
- aio_context_release(ctx);
- } else {
- ctx = NULL;
- }
-
WITH_QEMU_LOCK_GUARD(&aio_context_list_lock) {
/*
* No need for memory barriers, this works in pair with
* progress.
*/
aio_bh_poll(qemu_get_aio_context());
-
- if (ctx) {
- aio_context_acquire(ctx);
- }
-}
-
-void no_coroutine_fn bdrv_graph_wrunlock(BlockDriverState *bs)
-{
- AioContext *ctx = bs ? bdrv_get_aio_context(bs) : NULL;
-
- bdrv_graph_wrunlock_ctx(ctx);
}
void coroutine_fn bdrv_graph_co_rdlock(void)
* check for an op blocker on @to_replace, and we have our own
* there.
*/
- bdrv_graph_wrlock(target_bs);
+ bdrv_graph_wrlock();
if (bdrv_recurse_can_replace(src, to_replace)) {
bdrv_replace_node(to_replace, target_bs, &local_err);
} else {
"would not lead to an abrupt change of visible data",
to_replace->node_name, target_bs->node_name);
}
- bdrv_graph_wrunlock(target_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(to_replace);
if (local_err) {
error_report_err(local_err);
* valid.
*/
block_job_remove_all_bdrv(bjob);
- bdrv_graph_wrlock(mirror_top_bs);
+ bdrv_graph_wrlock();
bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, &error_abort);
- bdrv_graph_wrunlock(mirror_top_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(target_bs);
bdrv_unref(target_bs);
*/
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
BLK_PERM_CONSISTENT_READ,
errp);
if (ret < 0) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
goto fail;
}
ret = block_job_add_bdrv(&s->common, "intermediate node", iter, 0,
iter_shared_perms, errp);
if (ret < 0) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
goto fail;
}
}
if (bdrv_freeze_backing_chain(mirror_top_bs, target, errp) < 0) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
goto fail;
}
}
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
QTAILQ_INIT(&s->ops_in_flight);
bs_opaque->stop = true;
bdrv_drained_begin(bs);
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
assert(mirror_top_bs->backing->bs == bs);
bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
&error_abort);
bdrv_replace_node(mirror_top_bs, bs, &error_abort);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(bs);
bdrv_unref(mirror_top_bs);
if (close_data_file && has_data_file(bs)) {
GLOBAL_STATE_CODE();
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, s->data_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
s->data_file = NULL;
bdrv_graph_rdlock_main_loop();
}
close_exit:
/* cleanup on error */
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
for (i = 0; i < s->num_children; i++) {
if (!opened[i]) {
continue;
}
bdrv_unref_child(bs, s->children[i]);
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
g_free(s->children);
g_free(opened);
exit:
BDRVQuorumState *s = bs->opaque;
int i;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
for (i = 0; i < s->num_children; i++) {
bdrv_unref_child(bs, s->children[i]);
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
g_free(s->children);
}
return;
}
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
bdrv_ref(hidden_disk->bs);
s->hidden_disk = bdrv_attach_child(bs, hidden_disk->bs, "hidden disk",
&local_err);
if (local_err) {
error_propagate(errp, local_err);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
aio_context_release(aio_context);
return;
}
BDRV_CHILD_DATA, &local_err);
if (local_err) {
error_propagate(errp, local_err);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
aio_context_release(aio_context);
return;
}
if (!top_bs || !bdrv_is_root_node(top_bs) ||
!check_top_bs(top_bs, bs)) {
error_setg(errp, "No top_bs or it is invalid");
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
reopen_backing_file(bs, false, NULL);
aio_context_release(aio_context);
return;
bdrv_op_block_all(top_bs, s->blocker);
bdrv_op_unblock(top_bs, BLOCK_OP_TYPE_DATAPLANE, s->blocker);
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
s->backup_job = backup_job_create(
NULL, s->secondary_disk->bs, s->hidden_disk->bs,
if (ret == 0) {
s->stage = BLOCK_REPLICATION_DONE;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, s->secondary_disk);
s->secondary_disk = NULL;
bdrv_unref_child(bs, s->hidden_disk);
s->hidden_disk = NULL;
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
s->error = 0;
} else {
}
/* .bdrv_open() will re-attach it */
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, fallback);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
ret = bdrv_snapshot_goto(fallback_bs, snapshot_id, errp);
open_ret = drv->bdrv_open(bs, options, bs->open_flags, &local_err);
}
}
- bdrv_graph_wrlock(s->target_bs);
+ bdrv_graph_wrlock();
bdrv_set_backing_hd_drained(unfiltered_bs, base, &local_err);
- bdrv_graph_wrunlock(s->target_bs);
+ bdrv_graph_wrunlock();
/*
* This call will do I/O, so the graph can change again from here on.
* already have our own plans. Also don't allow resize as the image size is
* queried only at the job start and then cached.
*/
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
if (block_job_add_bdrv(&s->common, "active node", bs, 0,
basic_flags | BLK_PERM_WRITE, errp)) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
goto fail;
}
ret = block_job_add_bdrv(&s->common, "intermediate node", iter, 0,
basic_flags, errp);
if (ret < 0) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
goto fail;
}
}
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
s->base_overlay = base_overlay;
s->above_base = above_base;
BDRVVmdkState *s = bs->opaque;
VmdkExtent *e;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
for (i = 0; i < s->num_extents; i++) {
e = &s->extents[i];
g_free(e->l1_table);
bdrv_unref_child(bs, e->file);
}
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
g_free(s->extents);
}
0, 0, 0, 0, 0, &extent, errp);
if (ret < 0) {
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, extent_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_graph_rdlock_main_loop();
goto out;
}
g_free(buf);
if (ret) {
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, extent_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_graph_rdlock_main_loop();
goto out;
}
ret = vmdk_open_se_sparse(bs, extent_file, bs->open_flags, errp);
if (ret) {
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, extent_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_graph_rdlock_main_loop();
goto out;
}
} else {
error_setg(errp, "Unsupported extent type '%s'", type);
bdrv_graph_rdunlock_main_loop();
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(bs, extent_file);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_graph_rdlock_main_loop();
ret = -ENOTSUP;
goto out;
}
bdrv_drained_begin(state->new_bs);
- bdrv_graph_wrlock(state->old_bs);
+ bdrv_graph_wrlock();
bdrv_replace_node(state->new_bs, state->old_bs, &error_abort);
- bdrv_graph_wrunlock(state->old_bs);
+ bdrv_graph_wrunlock();
bdrv_drained_end(state->new_bs);
bdrv_unref(state->old_bs); /* bdrv_replace_node() ref'ed old_bs */
BlockDriverState *parent_bs, *new_bs = NULL;
BdrvChild *p_child;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
parent_bs = bdrv_lookup_bs(parent, parent, errp);
if (!parent_bs) {
}
out:
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
}
BlockJobInfoList *qmp_query_block_jobs(Error **errp)
* to process an already freed BdrvChild.
*/
aio_context_release(job->job.aio_context);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
aio_context_acquire(job->job.aio_context);
while (job->nodes) {
GSList *l = job->nodes;
g_slist_free_1(l);
}
- bdrv_graph_wrunlock_ctx(job->job.aio_context);
+ bdrv_graph_wrunlock();
}
bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs)
int ret;
GLOBAL_STATE_CODE();
- bdrv_graph_wrlock(bs);
+ bdrv_graph_wrlock();
if (job_id == NULL && !(flags & JOB_INTERNAL)) {
job_id = bdrv_get_device_name(bs);
job = job_create(job_id, &driver->job_driver, txn, bdrv_get_aio_context(bs),
flags, cb, opaque, errp);
if (job == NULL) {
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
return NULL;
}
goto fail;
}
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
return job;
fail:
- bdrv_graph_wrunlock(bs);
+ bdrv_graph_wrunlock();
job_early_fail(&job->job);
return NULL;
}
*
* The wrlock can only be taken from the main loop, with BQL held, as only the
* main loop is allowed to modify the graph.
- *
- * If @bs is non-NULL, its AioContext is temporarily released.
- *
- * This function polls. Callers must not hold the lock of any AioContext other
- * than the current one and the one of @bs.
*/
void no_coroutine_fn TSA_ACQUIRE(graph_lock) TSA_NO_TSA
-bdrv_graph_wrlock(BlockDriverState *bs);
+bdrv_graph_wrlock(void);
/*
* bdrv_graph_wrunlock:
* Write finished, reset global has_writer to 0 and restart
* all readers that are waiting.
- *
- * If @bs is non-NULL, its AioContext is temporarily released.
- */
-void no_coroutine_fn TSA_RELEASE(graph_lock) TSA_NO_TSA
-bdrv_graph_wrunlock(BlockDriverState *bs);
-
-/*
- * bdrv_graph_wrunlock_ctx:
- * Write finished, reset global has_writer to 0 and restart
- * all readers that are waiting.
- *
- * If @ctx is non-NULL, its lock is temporarily released.
*/
void no_coroutine_fn TSA_RELEASE(graph_lock) TSA_NO_TSA
-bdrv_graph_wrunlock_ctx(AioContext *ctx);
+bdrv_graph_wrunlock(void);
/*
* bdrv_graph_co_rdlock:
graph_lock=' bdrv_graph_rdlock_main_loop();'
graph_unlock=' bdrv_graph_rdunlock_main_loop();'
elif func.graph_wrlock:
- graph_lock=' bdrv_graph_wrlock(NULL);'
- graph_unlock=' bdrv_graph_wrunlock(NULL);'
+ graph_lock=' bdrv_graph_wrlock();'
+ graph_unlock=' bdrv_graph_wrunlock();'
return f"""\
/*
tjob->bs = src;
job = &tjob->common;
- bdrv_graph_wrlock(target);
+ bdrv_graph_wrlock();
block_job_add_bdrv(job, "target", target, 0, BLK_PERM_ALL, &error_abort);
- bdrv_graph_wrunlock(target);
+ bdrv_graph_wrunlock();
switch (result) {
case TEST_JOB_SUCCESS:
{
BdrvChild *c, *next_c;
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
QLIST_FOREACH_SAFE(c, &bs->children, next, next_c) {
bdrv_unref_child(bs, c);
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
}
static int coroutine_fn GRAPH_RDLOCK
null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
&error_abort);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(bs, null_bs, "null-child", &child_of_bds,
BDRV_CHILD_DATA, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
/* This child will be the one to pass to requests through to, and
* it will stall until a drain occurs */
&error_abort);
child_bs->total_sectors = 65536 >> BDRV_SECTOR_BITS;
/* Takes our reference to child_bs */
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
tts->wait_child = bdrv_attach_child(bs, child_bs, "wait-child",
&child_of_bds,
BDRV_CHILD_DATA | BDRV_CHILD_PRIMARY,
&error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
/* This child is just there to be deleted
* (for detach_instead_of_delete == true) */
null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
&error_abort);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(bs, null_bs, "null-child", &child_of_bds, BDRV_CHILD_DATA,
&error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
blk = blk_new(qemu_get_aio_context(), BLK_PERM_ALL, BLK_PERM_ALL);
blk_insert_bs(blk, bs, &error_abort);
bdrv_dec_in_flight(data->child_b->bs);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_unref_child(data->parent_b, data->child_b);
bdrv_ref(data->c);
data->child_c = bdrv_attach_child(data->parent_b, data->c, "PB-C",
&child_of_bds, BDRV_CHILD_DATA,
&error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
}
static void coroutine_mixed_fn detach_by_parent_aio_cb(void *opaque, int ret)
/* Set child relationships */
bdrv_ref(b);
bdrv_ref(a);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
child_b = bdrv_attach_child(parent_b, b, "PB-B", &child_of_bds,
BDRV_CHILD_DATA, &error_abort);
child_a = bdrv_attach_child(parent_b, a, "PB-A", &child_of_bds,
bdrv_attach_child(parent_a, a, "PA-A",
by_parent_cb ? &child_of_bds : &detach_by_driver_cb_class,
BDRV_CHILD_DATA, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
g_assert_cmpint(parent_a->refcnt, ==, 1);
g_assert_cmpint(parent_b->refcnt, ==, 1);
* Establish the chain last, so the chain links are the first
* elements in the BDS.parents lists
*/
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
for (i = 0; i < 3; i++) {
if (i) {
/* Takes the reference to chain[i - 1] */
&chain_child_class, BDRV_CHILD_COW, &error_abort);
}
}
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
job = block_job_create("job", &test_simple_job_driver, NULL, job_node,
0, BLK_PERM_ALL, 0, 0, NULL, NULL, &error_abort);
new_child_bs->total_sectors = 1;
bdrv_ref(old_child_bs);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(parent_bs, old_child_bs, "child", &child_of_bds,
BDRV_CHILD_COW, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
parent_s->setup_completed = true;
for (i = 0; i < old_drain_count; i++) {
g_assert(parent_bs->quiesce_counter == old_drain_count);
bdrv_drained_begin(old_child_bs);
bdrv_drained_begin(new_child_bs);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_replace_node(old_child_bs, new_child_bs, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_drained_end(new_child_bs);
bdrv_drained_end(old_child_bs);
g_assert(parent_bs->quiesce_counter == new_drain_count);
blk_insert_bs(root, bs, &error_abort);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(filter, bs, "child", &child_of_bds,
BDRV_CHILD_DATA, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
aio_context_acquire(qemu_get_aio_context());
ret = bdrv_append(filter, bs, NULL);
bdrv_set_backing_hd(target, bs, &error_abort);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
g_assert(target->backing->bs == bs);
bdrv_attach_child(filter, target, "target", &child_of_bds,
BDRV_CHILD_DATA, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
aio_context_acquire(qemu_get_aio_context());
bdrv_append(filter, bs, &error_abort);
aio_context_release(qemu_get_aio_context());
bdrv_ref(base);
bdrv_ref(fl1);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(top, fl1, "backing", &child_of_bds,
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
&error_abort);
&error_abort);
bdrv_replace_node(fl1, fl2, &error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
bdrv_drained_end(fl2);
bdrv_drained_end(fl1);
*/
bdrv_ref(base);
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(top, ws, "file", &child_of_bds, BDRV_CHILD_DATA,
&error_abort);
c_fl1 = bdrv_attach_child(ws, fl1, "first", &child_of_bds,
bdrv_attach_child(fl2, base, "backing", &child_of_bds,
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
&error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
/* Select fl1 as first child to be active */
s->selected = c_fl1;
BlockDriverState *base = no_perm_node("base");
BlockDriverState *fl = exclusive_writer_node("fl1");
- bdrv_graph_wrlock(NULL);
+ bdrv_graph_wrlock();
bdrv_attach_child(top, base, "backing", &child_of_bds,
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
&error_abort);
- bdrv_graph_wrunlock(NULL);
+ bdrv_graph_wrunlock();
aio_context_acquire(qemu_get_aio_context());
bdrv_append(fl, base, &error_abort);