summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorSergio Lopez2021-06-02 08:05:51 +0200
committerKevin Wolf2021-06-02 14:23:20 +0200
commit095cc4d0f62513d75e9bc1da37f08d9e97f267c4 (patch)
tree7e274b2a5d0feb2059bac2b94ef534f1b77a6af1 /block
parentblock: improve permission conflict error message (diff)
downloadqemu-095cc4d0f62513d75e9bc1da37f08d9e97f267c4.tar.gz
qemu-095cc4d0f62513d75e9bc1da37f08d9e97f267c4.tar.xz
qemu-095cc4d0f62513d75e9bc1da37f08d9e97f267c4.zip
block-backend: add drained_poll
Allow block backends to poll their devices/users to check if they have been quiesced when entering a drained section. This will be used in the next patch to wait for the NBD server to be completely quiesced. Suggested-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Sergio Lopez <slp@redhat.com> Message-Id: <20210602060552.17433-2-slp@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 5be32c0c42..15f1ea4288 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2386,8 +2386,13 @@ static void blk_root_drained_begin(BdrvChild *child)
static bool blk_root_drained_poll(BdrvChild *child)
{
BlockBackend *blk = child->opaque;
+ bool busy = false;
assert(blk->quiesce_counter);
- return !!blk->in_flight;
+
+ if (blk->dev_ops && blk->dev_ops->drained_poll) {
+ busy = blk->dev_ops->drained_poll(blk->dev_opaque);
+ }
+ return busy || !!blk->in_flight;
}
static void blk_root_drained_end(BdrvChild *child, int *drained_end_counter)