aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2021-10-05 18:11:57 +0200
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-10-05 18:56:41 +0200
commita9515df4d66da34cbc2938e4c1f46015fc74ff93 (patch)
treec4aba744a54f8190e710f5ad9b0db8a7c6fbe3e8 /block
parent8fc898ce0b3e7fea8c7c2a8d8977f2a9b77ecebf (diff)
block/aio_task: assert `max_busy_tasks` is greater than 0
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 <sgarzare@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211005161157.282396-3-sgarzare@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'block')
-rw-r--r--block/aio_task.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/aio_task.c b/block/aio_task.c
index 88989fa248..9bd17ea2c1 100644
--- a/block/aio_task.c
+++ b/block/aio_task.c
@@ -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;