diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-11-29 12:33:34 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-01-16 13:25:17 +0000 |
commit | 8f90b5e91df59fde0dfecc6738ff39f3edf14be5 (patch) | |
tree | 9f31ddef66b5fab9ded29175f402c44444213cc6 /block/io.c | |
parent | 2ccede18bd24fce5db83fef3674563a1f256717b (diff) | |
download | qemu-8f90b5e91df59fde0dfecc6738ff39f3edf14be5.zip qemu-8f90b5e91df59fde0dfecc6738ff39f3edf14be5.tar.gz qemu-8f90b5e91df59fde0dfecc6738ff39f3edf14be5.tar.bz2 |
block: get rid of bdrv_io_unplugged_begin/end
bdrv_io_plug and bdrv_io_unplug are only called (via their
BlockBackend equivalents) after starting asynchronous I/O.
bdrv_drain is not going to be called while they are running,
because---even if a coroutine runs for some reason---it will
only drain in the next iteration of the event loop through
bdrv_co_yield_to_drain.
So this mechanism is unnecessary, get rid of it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20161129113334.605-1-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 41 |
1 files changed, 2 insertions, 39 deletions
@@ -228,9 +228,7 @@ void bdrv_drained_begin(BlockDriverState *bs) bdrv_parent_drained_begin(bs); } - bdrv_io_unplugged_begin(bs); bdrv_drain_recurse(bs); - bdrv_io_unplugged_end(bs); } void bdrv_drained_end(BlockDriverState *bs) @@ -302,7 +300,6 @@ void bdrv_drain_all_begin(void) aio_context_acquire(aio_context); bdrv_parent_drained_begin(bs); - bdrv_io_unplugged_begin(bs); aio_disable_external(aio_context); aio_context_release(aio_context); @@ -347,7 +344,6 @@ void bdrv_drain_all_end(void) aio_context_acquire(aio_context); aio_enable_external(aio_context); - bdrv_io_unplugged_end(bs); bdrv_parent_drained_end(bs); aio_context_release(aio_context); } @@ -2650,7 +2646,7 @@ void bdrv_io_plug(BlockDriverState *bs) bdrv_io_plug(child->bs); } - if (bs->io_plugged++ == 0 && bs->io_plug_disabled == 0) { + if (bs->io_plugged++ == 0) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_io_plug) { drv->bdrv_io_plug(bs); @@ -2663,7 +2659,7 @@ void bdrv_io_unplug(BlockDriverState *bs) BdrvChild *child; assert(bs->io_plugged); - if (--bs->io_plugged == 0 && bs->io_plug_disabled == 0) { + if (--bs->io_plugged == 0) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_io_unplug) { drv->bdrv_io_unplug(bs); @@ -2674,36 +2670,3 @@ void bdrv_io_unplug(BlockDriverState *bs) bdrv_io_unplug(child->bs); } } - -void bdrv_io_unplugged_begin(BlockDriverState *bs) -{ - BdrvChild *child; - - if (bs->io_plug_disabled++ == 0 && bs->io_plugged > 0) { - BlockDriver *drv = bs->drv; - if (drv && drv->bdrv_io_unplug) { - drv->bdrv_io_unplug(bs); - } - } - - QLIST_FOREACH(child, &bs->children, next) { - bdrv_io_unplugged_begin(child->bs); - } -} - -void bdrv_io_unplugged_end(BlockDriverState *bs) -{ - BdrvChild *child; - - assert(bs->io_plug_disabled); - QLIST_FOREACH(child, &bs->children, next) { - bdrv_io_unplugged_end(child->bs); - } - - if (--bs->io_plug_disabled == 0 && bs->io_plugged > 0) { - BlockDriver *drv = bs->drv; - if (drv && drv->bdrv_io_plug) { - drv->bdrv_io_plug(bs); - } - } -} |