]> git.proxmox.com Git - mirror_qemu.git/commit
block: Make bdrv_drain_invoke() recursive
authorKevin Wolf <kwolf@redhat.com>
Tue, 5 Dec 2017 11:52:09 +0000 (12:52 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 9 Jan 2018 16:48:39 +0000 (10:48 -0600)
commit057364da7741285284fc2f6fd9ad8921bda6438b
tree8d119669822a7f784729117d28d534b5c9b9f9d5
parentb9da3c1de7829a982685029222482cc5914638f4
block: Make bdrv_drain_invoke() recursive

This change separates bdrv_drain_invoke(), which calls the BlockDriver
drain callbacks, from bdrv_drain_recurse(). Instead, the function
performs its own recursion now.

One reason for this is that bdrv_drain_recurse() can be called multiple
times by bdrv_drain_all_begin(), but the callbacks may only be called
once. The separation is necessary to fix this bug.

The other reason is that we intend to go to a model where we call all
driver callbacks first, and only then start polling. This is not fully
achieved yet with this patch, as bdrv_drain_invoke() contains a
BDRV_POLL_WHILE() loop for the block driver callbacks, which can still
call callbacks for any unrelated event. It's a step in this direction
anyway.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit db0289b9b26cb653d5662f5d6a2a52d70243cd56)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/io.c