parallelize: Create number of shards requested by user

In some scenarios running the exact number of shards, regardless of
number of available queues is crucial for correctness of operation.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Robert Baldyga 2023-07-05 23:10:36 +02:00 committed by Michal Mielewczyk
parent 5c714cb3de
commit 55b99518ed

View File

@ -64,10 +64,7 @@ int ocf_parallelize_create(ocf_parallelize_t *parallelize,
queue_count = ocf_cache_get_queue_count(cache); queue_count = ocf_cache_get_queue_count(cache);
if (shards_cnt == 0) if (shards_cnt == 0)
shards_cnt = queue_count; shards_cnt = queue_count ?: 1;
if (queue_count == 0)
shards_cnt = 1;
prl_size = sizeof(*tmp_parallelize) + prl_size = sizeof(*tmp_parallelize) +
shards_cnt * sizeof(*tmp_parallelize->reqs); shards_cnt * sizeof(*tmp_parallelize->reqs);