block: throttle-groups: Use BlockBackend pointers internally
As a first step towards moving I/O throttling to the BlockBackend level, this patch changes all pointers in struct ThrottleGroup from referencing a BlockDriverState to referencing a BlockBackend. This change is valid because we made sure that throttling can only be enabled on BDSes which have a BB attached. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
f2cd875d54
commit
31dce3ccca
6 changed files with 83 additions and 78 deletions
|
|
@ -435,7 +435,6 @@ struct BlockDriverState {
|
|||
ThrottleState *throttle_state;
|
||||
ThrottleTimers throttle_timers;
|
||||
unsigned pending_reqs[2];
|
||||
QLIST_ENTRY(BlockDriverState) round_robin;
|
||||
|
||||
/* Offset after the highest byte written to */
|
||||
uint64_t wr_highest_offset;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ void throttle_group_unref(ThrottleState *ts);
|
|||
void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
void throttle_group_get_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
|
||||
void throttle_group_register_bs(BlockDriverState *bs, const char *groupname);
|
||||
void throttle_group_unregister_bs(BlockDriverState *bs);
|
||||
void throttle_group_register_blk(BlockBackend *blk, const char *groupname);
|
||||
void throttle_group_unregister_blk(BlockBackend *blk);
|
||||
void throttle_group_restart_bs(BlockDriverState *bs);
|
||||
|
||||
void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,10 @@ typedef struct BlockDevOps {
|
|||
* fields that must be public. This is in particular for QLIST_ENTRY() and
|
||||
* friends so that BlockBackends can be kept in lists outside block-backend.c */
|
||||
typedef struct BlockBackendPublic {
|
||||
int dummy; /* empty structs are illegal */
|
||||
/* I/O throttling */
|
||||
/* The following fields are protected by the ThrottleGroup lock.
|
||||
* See the ThrottleGroup documentation for details. */
|
||||
QLIST_ENTRY(BlockBackendPublic) round_robin;
|
||||
} BlockBackendPublic;
|
||||
|
||||
BlockBackend *blk_new(Error **errp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue