[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] throttle: support read-only and write-only
From: |
Alberto Garcia |
Subject: |
Re: [PATCH 3/5] throttle: support read-only and write-only |
Date: |
Mon, 26 Jun 2023 21:38:23 +0000 |
On Sun 25 Jun 2023 04:56:29 PM +08, zhenwei pi wrote:
> void throttle_timers_attach_aio_context(ThrottleTimers *tt,
> AioContext *new_context)
> {
> - tt->timers[THROTTLE_TIMER_READ] =
> - aio_timer_new(new_context, tt->clock_type, SCALE_NS,
> - tt->timer_cb[THROTTLE_TIMER_READ], tt->timer_opaque);
> - tt->timers[THROTTLE_TIMER_WRITE] =
> - aio_timer_new(new_context, tt->clock_type, SCALE_NS,
> - tt->timer_cb[THROTTLE_TIMER_WRITE], tt->timer_opaque);
> + if (tt->timer_cb[THROTTLE_TIMER_READ]) {
> + tt->timers[THROTTLE_TIMER_READ] =
> + aio_timer_new(new_context, tt->clock_type, SCALE_NS,
> + tt->timer_cb[THROTTLE_TIMER_READ],
> tt->timer_opaque);
> + }
> +
> + if (tt->timer_cb[THROTTLE_TIMER_WRITE]) {
> + tt->timers[THROTTLE_TIMER_WRITE] =
> + aio_timer_new(new_context, tt->clock_type, SCALE_NS,
> + tt->timer_cb[THROTTLE_TIMER_WRITE],
> tt->timer_opaque);
> + }
> }
If now any of the timers can be NULL, don't you want to add additional
checks / assertions to (at least) throttle_schedule_timer() ?
Berto
- [PATCH 0/5] Misc fixes for throttle, zhenwei pi, 2023/06/25
- [PATCH 1/5] throttle: introduce enum ThrottleTimerType, zhenwei pi, 2023/06/25
- [PATCH 2/5] test-throttle: use enum ThrottleTimerType, zhenwei pi, 2023/06/25
- [PATCH 3/5] throttle: support read-only and write-only, zhenwei pi, 2023/06/25
- Re: [PATCH 3/5] throttle: support read-only and write-only,
Alberto Garcia <=
- [PATCH 4/5] test-throttle: test read only and write only, zhenwei pi, 2023/06/25
- [PATCH 5/5] cryptodev: use NULL throttle timer cb for read direction, zhenwei pi, 2023/06/25