block: introduce bdrv_no_throttling_begin/end

Extract the handling of throttling from bdrv_flush_io_queue.  These
new functions will soon become BdrvChildRole callbacks, as they can
be generalized to "beginning of drain" and "end of drain".

Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2016-04-07 18:33:33 +02:00 committed by Kevin Wolf
parent b6e84c97ed
commit ce0f141259
5 changed files with 33 additions and 20 deletions

View file

@ -424,10 +424,10 @@ struct BlockDriverState {
/* I/O throttling.
* throttle_state tells us if this BDS has I/O limits configured.
* io_limits_enabled tells us if they are currently being
* enforced, but it can be temporarily set to false */
* io_limits_disabled tells us if they are currently being enforced */
CoQueue throttled_reqs[2];
bool io_limits_enabled;
unsigned int io_limits_disabled;
/* The following fields are protected by the ThrottleGroup lock.
* See the ThrottleGroup documentation for details. */
ThrottleState *throttle_state;
@ -713,6 +713,9 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
const BdrvChildRole *child_role);
void bdrv_root_unref_child(BdrvChild *child);
void bdrv_no_throttling_begin(BlockDriverState *bs);
void bdrv_no_throttling_end(BlockDriverState *bs);
void blk_dev_change_media_cb(BlockBackend *blk, bool load);
bool blk_dev_has_removable_media(BlockBackend *blk);
bool blk_dev_has_tray(BlockBackend *blk);