diff options
author | Kevin Wolf <kwolf@redhat.com> | 2017-09-14 14:53:46 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-09-26 14:46:23 +0200 |
commit | 1857c97b76af02537b954c86dab066503950a4fd (patch) | |
tree | e0076a5d3a30fb32f084939b871816005a465542 /block.c | |
parent | 148eb13c84cccd0eedd6e59f90e0151bd7bac9fa (diff) | |
download | qemu-1857c97b76af02537b954c86dab066503950a4fd.zip qemu-1857c97b76af02537b954c86dab066503950a4fd.tar.gz qemu-1857c97b76af02537b954c86dab066503950a4fd.tar.bz2 |
block: reopen: Queue children after their parents
We will calculate the required new permissions in the prepare stage of a
reopen. Required permissions of children can be influenced by the
changes made to their parents, but parents are independent from their
children. This means that permissions need to be calculated top-down. In
order to achieve this, queue parents before their children rather than
queuing the children first.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -2768,6 +2768,19 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue, flags |= BDRV_O_ALLOW_RDWR; } + if (!bs_entry) { + bs_entry = g_new0(BlockReopenQueueEntry, 1); + QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry); + } else { + QDECREF(bs_entry->state.options); + QDECREF(bs_entry->state.explicit_options); + } + + bs_entry->state.bs = bs; + bs_entry->state.options = options; + bs_entry->state.explicit_options = explicit_options; + bs_entry->state.flags = flags; + QLIST_FOREACH(child, &bs->children, next) { QDict *new_child_options; char *child_key_dot; @@ -2787,19 +2800,6 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue, child->role, options, flags); } - if (!bs_entry) { - bs_entry = g_new0(BlockReopenQueueEntry, 1); - QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry); - } else { - QDECREF(bs_entry->state.options); - QDECREF(bs_entry->state.explicit_options); - } - - bs_entry->state.bs = bs; - bs_entry->state.options = options; - bs_entry->state.explicit_options = explicit_options; - bs_entry->state.flags = flags; - return bs_queue; } |