aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-12-18 16:05:48 +0100
committerKevin Wolf <kwolf@redhat.com>2017-12-22 15:05:32 +0100
commitd736f119dae6d292e8d60f2e02fa51a79524113e (patch)
treed43428b92070b16badcd30678dde7974e0be02ac /include
parent27e64474a384e68ca928fa875930b921b53d61f4 (diff)
downloadqemu-d736f119dae6d292e8d60f2e02fa51a79524113e.zip
qemu-d736f119dae6d292e8d60f2e02fa51a79524113e.tar.gz
qemu-d736f119dae6d292e8d60f2e02fa51a79524113e.tar.bz2
block: Allow graph changes in subtree drained section
We need to remember how many of the drain sections in which a node is were recursive (i.e. subtree drain rather than node drain), so that they can be correctly applied when children are added or removed during the drained section. With this change, it is safe to modify the graph even inside a bdrv_subtree_drained_begin/end() section. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h2
-rw-r--r--include/block/block_int.h5
2 files changed, 5 insertions, 2 deletions
diff --git a/include/block/block.h b/include/block/block.h
index de9c5a2..9b12774 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -610,8 +610,6 @@ void bdrv_drained_begin(BlockDriverState *bs);
/**
* Like bdrv_drained_begin, but recursively begins a quiesced section for
* exclusive access to all child nodes as well.
- *
- * Graph changes are not allowed during a subtree drain section.
*/
void bdrv_subtree_drained_begin(BlockDriverState *bs);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index e107163..29cafa4 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -717,6 +717,8 @@ struct BlockDriverState {
/* Accessed with atomic ops. */
int quiesce_counter;
+ int recursive_quiesce_counter;
+
unsigned int write_gen; /* Current data generation */
/* Protected by reqs_lock. */
@@ -768,6 +770,9 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags);
+void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent);
+void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent);
+
int get_tmp_filename(char *filename, int size);
BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size,
const char *filename);