summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-22 13:00:08 +0100
committerKevin Wolf <kwolf@redhat.com>2016-05-19 16:45:30 +0200
commit7ca7f0f6db1fedd28d490795d778cf23979a2aa7 (patch)
tree0304aae791827e914e5cf677bb4a9864efcd3641 /block.c
parentbb9aaecaf1d9b9d7da8f8c73a4cbf3afd9848abe (diff)
downloadqemu-7ca7f0f6db1fedd28d490795d778cf23979a2aa7.tar.gz
block: Decouple throttling from BlockDriverState
This moves the throttling related part of the BDS life cycle management to BlockBackend. The throttling group reference is now kept even when no medium is inserted. With this commit, throttling isn't disabled and then re-enabled any more during graph reconfiguration. This fixes the temporary breakage of I/O throttling when used with live snapshots or block jobs that manipulate the graph. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/block.c b/block.c
index b5c02c4654..98226fe073 100644
--- a/block.c
+++ b/block.c
@@ -38,7 +38,6 @@
#include "qmp-commands.h"
#include "qemu/timer.h"
#include "qapi-event.h"
-#include "block/throttle-groups.h"
#include "qemu/cutils.h"
#include "qemu/id.h"
@@ -2121,11 +2120,6 @@ static void bdrv_close(BlockDriverState *bs)
assert(!bs->job);
- /* Disable I/O limits and drain all pending throttled requests */
- if (bs->blk && blk_get_public(bs->blk)->throttle_state) {
- blk_io_limits_disable(bs->blk);
- }
-
bdrv_drained_begin(bs); /* complete I/O */
bdrv_flush(bs);
bdrv_drain(bs); /* in case flush left pending I/O */
@@ -2254,26 +2248,6 @@ static void swap_feature_fields(BlockDriverState *bs_top,
bdrv_move_feature_fields(&tmp, bs_top);
bdrv_move_feature_fields(bs_top, bs_new);
bdrv_move_feature_fields(bs_new, &tmp);
-
- assert(!bs_new->blk);
- if (bs_top->blk && blk_get_public(bs_top->blk)->throttle_state) {
- /*
- * FIXME Need to break I/O throttling with graph manipulations
- * temporarily because of conflicting invariants (3. will go away when
- * throttling is fully converted to work on BlockBackends):
- *
- * 1. Every BlockBackend has a single root BDS
- * 2. I/O throttling functions require an attached BlockBackend
- * 3. We need to first enable throttling on the new BDS and then
- * disable it on the old one (because of throttle group refcounts)
- */
-#if 0
- bdrv_io_limits_enable(bs_new, throttle_group_get_name(bs_top));
- bdrv_io_limits_disable(bs_top);
-#else
- abort();
-#endif
- }
}
/*
@@ -3674,10 +3648,6 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
baf->detach_aio_context(baf->opaque);
}
- if (bs->blk && blk_get_public(bs->blk)->throttle_state) {
- throttle_timers_detach_aio_context(
- &blk_get_public(bs->blk)->throttle_timers);
- }
if (bs->drv->bdrv_detach_aio_context) {
bs->drv->bdrv_detach_aio_context(bs);
}
@@ -3711,10 +3681,6 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
if (bs->drv->bdrv_attach_aio_context) {
bs->drv->bdrv_attach_aio_context(bs, new_context);
}
- if (bs->blk && blk_get_public(bs->blk)->throttle_state) {
- throttle_timers_attach_aio_context(
- &blk_get_public(bs->blk)->throttle_timers, new_context);
- }
QLIST_FOREACH(ban, &bs->aio_notifiers, list) {
ban->attached_aio_context(new_context, ban->opaque);