[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 23/43] block: Add BdrvChildRole.stay_at_node
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH v2 23/43] block: Add BdrvChildRole.stay_at_node |
Date: |
Mon, 27 Feb 2017 21:09:24 +0100 |
When the parents' child links are updated in bdrv_append() or
bdrv_replace_in_backing_chain(), this should affect all child links of
BlockBackends or other nodes, but not on child links held for other
purposes (like for setting permissions). This patch allows to control
the behaviour per BdrvChildRole.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block.c | 3 +++
include/block/block_int.h | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/block.c b/block.c
index a0c1886..6456917 100644
--- a/block.c
+++ b/block.c
@@ -2844,6 +2844,9 @@ static void change_parent_backing_link(BlockDriverState
*from,
BdrvChild *c, *next, *to_c;
QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) {
+ if (c->role->stay_at_node) {
+ continue;
+ }
if (c->role == &child_backing) {
/* @from is generally not allowed to be a backing file, except for
* when @to is the overlay. In that case, @from may not be replaced
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 3177b9f..a0d9328 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -441,6 +441,10 @@ typedef struct BdrvAioNotifier {
} BdrvAioNotifier;
struct BdrvChildRole {
+ /* If true, bdrv_replace_in_backing_chain() doesn't change the node this
+ * BdrvChild points to. */
+ bool stay_at_node;
+
void (*inherit_options)(int *child_flags, QDict *child_options,
int parent_flags, QDict *parent_options);
--
1.8.3.1
- [Qemu-block] [PATCH v2 13/43] block: Add permissions to blk_new(), (continued)
- [Qemu-block] [PATCH v2 13/43] block: Add permissions to blk_new(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 14/43] block: Add error parameter to blk_insert_bs(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 15/43] block: Add BDRV_O_RESIZE for blk_new_open(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 16/43] block: Request real permissions in blk_new_open(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 17/43] block: Allow error return in BlockDevOps.change_media_cb(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 18/43] hw/block: Request permissions, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 19/43] hw/block: Introduce share-rw qdev property, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 20/43] blockjob: Add permissions to block_job_create(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 21/43] block: Add BdrvChildRole.get_parent_desc(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 22/43] block: Include details on permission errors in message, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 23/43] block: Add BdrvChildRole.stay_at_node,
Kevin Wolf <=
- [Qemu-block] [PATCH v2 24/43] blockjob: Add permissions to block_job_add_bdrv(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 25/43] commit: Use real permissions in commit block job, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 26/43] commit: Use real permissions for HMP 'commit', Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 27/43] backup: Use real permissions in backup block job, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 28/43] block: Fix pending requests check in bdrv_append(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 29/43] block: BdrvChildRole.attach/detach() callbacks, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 30/43] block: Allow backing file links in change_parent_backing_link(), Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 32/43] stream: Use real permissions in streaming block job, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 31/43] mirror: Use real permissions in mirror/active commit block job, Kevin Wolf, 2017/02/27
- [Qemu-block] [PATCH v2 33/43] mirror: Add filter-node-name to blockdev-mirror, Kevin Wolf, 2017/02/27