summaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-21 13:30:30 +0100
committerKevin Wolf <kwolf@redhat.com>2016-05-19 16:45:30 +0200
commit441565b2792d4ee9ee1928a8d14538be39211292 (patch)
tree1d705206c19f29bba69bf5467c73ca339d3e62b1 /block/block-backend.c
parent27ccdd52598290f0f8b58be56e235aff7aebfaf3 (diff)
downloadqemu-441565b2792d4ee9ee1928a8d14538be39211292.tar.gz
block: Move actual I/O throttling to BlockBackend
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/block-backend.c')
-rw-r--r--block/block-backend.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 6880659665..730b8a9949 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -716,6 +716,11 @@ static int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
return ret;
}
+ /* throttling disk I/O */
+ if (blk->public.throttle_state) {
+ throttle_group_co_io_limits_intercept(blk, bytes, false);
+ }
+
return bdrv_co_preadv(blk_bs(blk), offset, bytes, qiov, flags);
}
@@ -730,6 +735,11 @@ static int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
return ret;
}
+ /* throttling disk I/O */
+ if (blk->public.throttle_state) {
+ throttle_group_co_io_limits_intercept(blk, bytes, true);
+ }
+
if (!blk->enable_write_cache) {
flags |= BDRV_REQ_FUA;
}