]> 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)
committerKevin Wolf <kwolf@redhat.com>
Fri, 22 Dec 2017 14:03:41 +0000 (15:03 +0100)
commitdb0289b9b26cb653d5662f5d6a2a52d70243cd56
treef220f507d3728894757c187331f022dee7a89df5
parentbff5554843773d8ca644fddd37ffebcc952ce48f
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>
block/io.c