Skip to content

Commit

Permalink
block/aio_task: assert max_busy_tasks is greater than 0
Browse files Browse the repository at this point in the history
All code in block/aio_task.c expects `max_busy_tasks` to always
be greater than 0.

Assert this condition during the AioTaskPool creation where
`max_busy_tasks` is set.

Signed-off-by: Stefano Garzarella <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
  • Loading branch information
stefano-garzarella authored and Vladimir Sementsov-Ogievskiy committed Oct 5, 2021
1 parent 8fc898c commit a9515df
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/aio_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ AioTaskPool *coroutine_fn aio_task_pool_new(int max_busy_tasks)
{
AioTaskPool *pool = g_new0(AioTaskPool, 1);

assert(max_busy_tasks > 0);

pool->main_co = qemu_coroutine_self();
pool->max_busy_tasks = max_busy_tasks;

Expand Down

0 comments on commit a9515df

Please sign in to comment.