[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 16/24] block: reopen: Queue children after their pare
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 16/24] block: reopen: Queue children after their parents |
Date: |
Tue, 26 Sep 2017 16:21:25 +0200 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/block.c b/block.c
index ed8d51dd42..204cbb46c7 100644
--- a/block.c
+++ b/block.c
@@ -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;
}
--
2.13.5
- [Qemu-block] [PULL 07/24] iotests: use virtio aliases for 067, (continued)
- [Qemu-block] [PULL 07/24] iotests: use virtio aliases for 067, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 09/24] throttle: Assert that bkt->max is valid in throttle_compute_wait(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 10/24] block/throttle-groups.c: allocate RestartData on the heap, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 13/24] block: Add reopen_queue to bdrv_child_perm(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 12/24] qemu-io: Drop write permissions before read-only reopen, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 17/24] block: Fix permissions after bdrv_reopen(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 11/24] block: Clean up some bad code in the vvfat driver, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 14/24] block: Add reopen queue to bdrv_check_perm(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 15/24] block: Base permissions on rw state after reopen, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 18/24] qemu-iotests: Test change-backing-file command, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 16/24] block: reopen: Queue children after their parents,
Kevin Wolf <=
- [Qemu-block] [PULL 19/24] iotests: fix 181: enable postcopy-ram capability on target, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 22/24] qcow2: add shrink image support, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 20/24] qemu-img: add --shrink flag for resize, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 23/24] qemu-iotests: add shrinking image test, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 24/24] block/qcow2-bitmap: fix use of uninitialized pointer, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 21/24] qcow2: add qcow2_cache_discard, Kevin Wolf, 2017/09/26
- Re: [Qemu-block] [PULL 00/24] Block layer patches, Peter Maydell, 2017/09/27