mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: move ThrottleGroup membership to ThrottleGroupMember
This commit eliminates the 1:1 relationship between BlockBackend and throttle group state. Users will be able to create multiple throttle nodes, each with its own throttle group state, in the future. The throttle group state cannot be per-BlockBackend anymore, it must be per-throttle node. This is done by gathering ThrottleGroup membership details from BlockBackendPublic into ThrottleGroupMember and refactoring existing code to use the structure. Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
64182a6b8b
commit
022cdc9f40
7 changed files with 252 additions and 226 deletions
|
@ -70,24 +70,10 @@ typedef struct BlockDevOps {
|
|||
|
||||
/* This struct is embedded in (the private) BlockBackend struct and contains
|
||||
* 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 */
|
||||
* friends so that BlockBackends can be kept in lists outside block-backend.c
|
||||
* */
|
||||
typedef struct BlockBackendPublic {
|
||||
/* throttled_reqs_lock protects the CoQueues for throttled requests. */
|
||||
CoMutex throttled_reqs_lock;
|
||||
CoQueue throttled_reqs[2];
|
||||
|
||||
/* Nonzero if the I/O limits are currently being ignored; generally
|
||||
* it is zero. Accessed with atomic operations.
|
||||
*/
|
||||
unsigned int io_limits_disabled;
|
||||
|
||||
/* The following fields are protected by the ThrottleGroup lock.
|
||||
* See the ThrottleGroup documentation for details.
|
||||
* throttle_state tells us if I/O limits are configured. */
|
||||
ThrottleState *throttle_state;
|
||||
ThrottleTimers throttle_timers;
|
||||
unsigned pending_reqs[2];
|
||||
QLIST_ENTRY(BlockBackendPublic) round_robin;
|
||||
ThrottleGroupMember throttle_group_member;
|
||||
} BlockBackendPublic;
|
||||
|
||||
BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue