@@ -301,6 +301,7 @@ void vio_record_metadata_io_error(struct vio *vio)
301
301
* make_vio_pool() - Create a new vio pool.
302
302
* @vdo: The vdo.
303
303
* @pool_size: The number of vios in the pool.
304
+ * @block_count: The number of 4k blocks per vio.
304
305
* @thread_id: The ID of the thread using this pool.
305
306
* @vio_type: The type of vios in the pool.
306
307
* @priority: The priority with which vios from the pool should be enqueued.
@@ -309,13 +310,14 @@ void vio_record_metadata_io_error(struct vio *vio)
309
310
*
310
311
* Return: A success or error code.
311
312
*/
312
- int make_vio_pool (struct vdo * vdo , size_t pool_size , thread_id_t thread_id ,
313
+ int make_vio_pool (struct vdo * vdo , size_t pool_size , size_t block_count , thread_id_t thread_id ,
313
314
enum vio_type vio_type , enum vio_priority priority , void * context ,
314
315
struct vio_pool * * pool_ptr )
315
316
{
316
317
struct vio_pool * pool ;
317
318
char * ptr ;
318
319
int result ;
320
+ size_t per_vio_size = VDO_BLOCK_SIZE * block_count ;
319
321
320
322
result = vdo_allocate_extended (struct vio_pool , pool_size , struct pooled_vio ,
321
323
__func__ , & pool );
@@ -326,18 +328,18 @@ int make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t thread_id,
326
328
INIT_LIST_HEAD (& pool -> available );
327
329
INIT_LIST_HEAD (& pool -> busy );
328
330
329
- result = vdo_allocate (pool_size * VDO_BLOCK_SIZE , char ,
331
+ result = vdo_allocate (pool_size * per_vio_size , char ,
330
332
"VIO pool buffer" , & pool -> buffer );
331
333
if (result != VDO_SUCCESS ) {
332
334
free_vio_pool (pool );
333
335
return result ;
334
336
}
335
337
336
338
ptr = pool -> buffer ;
337
- for (pool -> size = 0 ; pool -> size < pool_size ; pool -> size ++ , ptr += VDO_BLOCK_SIZE ) {
339
+ for (pool -> size = 0 ; pool -> size < pool_size ; pool -> size ++ , ptr += per_vio_size ) {
338
340
struct pooled_vio * pooled = & pool -> vios [pool -> size ];
339
341
340
- result = allocate_vio_components (vdo , vio_type , priority , NULL , 1 , ptr ,
342
+ result = allocate_vio_components (vdo , vio_type , priority , NULL , block_count , ptr ,
341
343
& pooled -> vio );
342
344
if (result != VDO_SUCCESS ) {
343
345
free_vio_pool (pool );
0 commit comments