mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
fsdev: Use ThrottleDirection instread of bool is_write
'bool is_write' style is obsolete from throttle framework, adapt fsdev to the new style. Cc: Greg Kurz <groug@kaod.org> Reviewed-by: Hanna Czenczek <hreitz@redhat.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20230728022006.1098509-9-pizhenwei@bytedance.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
This commit is contained in:
parent
7017313882
commit
00ea69f503
3 changed files with 11 additions and 11 deletions
|
@ -94,22 +94,22 @@ void fsdev_throttle_init(FsThrottle *fst)
|
|||
}
|
||||
}
|
||||
|
||||
void coroutine_fn fsdev_co_throttle_request(FsThrottle *fst, bool is_write,
|
||||
void coroutine_fn fsdev_co_throttle_request(FsThrottle *fst,
|
||||
ThrottleDirection direction,
|
||||
struct iovec *iov, int iovcnt)
|
||||
{
|
||||
ThrottleDirection direction = is_write ? THROTTLE_WRITE : THROTTLE_READ;
|
||||
|
||||
assert(direction < THROTTLE_MAX);
|
||||
if (throttle_enabled(&fst->cfg)) {
|
||||
if (throttle_schedule_timer(&fst->ts, &fst->tt, direction) ||
|
||||
!qemu_co_queue_empty(&fst->throttled_reqs[is_write])) {
|
||||
qemu_co_queue_wait(&fst->throttled_reqs[is_write], NULL);
|
||||
!qemu_co_queue_empty(&fst->throttled_reqs[direction])) {
|
||||
qemu_co_queue_wait(&fst->throttled_reqs[direction], NULL);
|
||||
}
|
||||
|
||||
throttle_account(&fst->ts, direction, iov_size(iov, iovcnt));
|
||||
|
||||
if (!qemu_co_queue_empty(&fst->throttled_reqs[is_write]) &&
|
||||
if (!qemu_co_queue_empty(&fst->throttled_reqs[direction]) &&
|
||||
!throttle_schedule_timer(&fst->ts, &fst->tt, direction)) {
|
||||
qemu_co_queue_next(&fst->throttled_reqs[is_write]);
|
||||
qemu_co_queue_next(&fst->throttled_reqs[direction]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue