mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
throttle: use enum ThrottleDirection instead of bool is_write
enum ThrottleDirection is already there, use ThrottleDirection instead of 'bool is_write' for throttle API, also modify related codes from block, fsdev, cryptodev and tests. Reviewed-by: Hanna Czenczek <hreitz@redhat.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20230728022006.1098509-7-pizhenwei@bytedance.com> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
This commit is contained in:
parent
27cf12298a
commit
e76f201f69
6 changed files with 36 additions and 27 deletions
|
@ -252,10 +252,11 @@ static void cryptodev_backend_throttle_timer_cb(void *opaque)
|
|||
continue;
|
||||
}
|
||||
|
||||
throttle_account(&backend->ts, true, ret);
|
||||
throttle_account(&backend->ts, THROTTLE_WRITE, ret);
|
||||
cryptodev_backend_operation(backend, op_info);
|
||||
if (throttle_enabled(&backend->tc) &&
|
||||
throttle_schedule_timer(&backend->ts, &backend->tt, true)) {
|
||||
throttle_schedule_timer(&backend->ts, &backend->tt,
|
||||
THROTTLE_WRITE)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +272,7 @@ int cryptodev_backend_crypto_operation(
|
|||
goto do_account;
|
||||
}
|
||||
|
||||
if (throttle_schedule_timer(&backend->ts, &backend->tt, true) ||
|
||||
if (throttle_schedule_timer(&backend->ts, &backend->tt, THROTTLE_WRITE) ||
|
||||
!QTAILQ_EMPTY(&backend->opinfos)) {
|
||||
QTAILQ_INSERT_TAIL(&backend->opinfos, op_info, next);
|
||||
return 0;
|
||||
|
@ -283,7 +284,7 @@ do_account:
|
|||
return ret;
|
||||
}
|
||||
|
||||
throttle_account(&backend->ts, true, ret);
|
||||
throttle_account(&backend->ts, THROTTLE_WRITE, ret);
|
||||
|
||||
return cryptodev_backend_operation(backend, op_info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue