@@ -301,6 +301,7 @@ void vio_record_metadata_io_error(struct vio *vio)
301301 * make_vio_pool() - Create a new vio pool.
302302 * @vdo: The vdo.
303303 * @pool_size: The number of vios in the pool.
304+ * @block_count: The number of 4k blocks per vio.
304305 * @thread_id: The ID of the thread using this pool.
305306 * @vio_type: The type of vios in the pool.
306307 * @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)
309310 *
310311 * Return: A success or error code.
311312 */
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 ,
313314 enum vio_type vio_type , enum vio_priority priority , void * context ,
314315 struct vio_pool * * pool_ptr )
315316{
316317 struct vio_pool * pool ;
317318 char * ptr ;
318319 int result ;
320+ size_t per_vio_size = VDO_BLOCK_SIZE * block_count ;
319321
320322 result = vdo_allocate_extended (struct vio_pool , pool_size , struct pooled_vio ,
321323 __func__ , & pool );
@@ -326,18 +328,18 @@ int make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t thread_id,
326328 INIT_LIST_HEAD (& pool -> available );
327329 INIT_LIST_HEAD (& pool -> busy );
328330
329- result = vdo_allocate (pool_size * VDO_BLOCK_SIZE , char ,
331+ result = vdo_allocate (pool_size * per_vio_size , char ,
330332 "VIO pool buffer" , & pool -> buffer );
331333 if (result != VDO_SUCCESS ) {
332334 free_vio_pool (pool );
333335 return result ;
334336 }
335337
336338 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 ) {
338340 struct pooled_vio * pooled = & pool -> vios [pool -> size ];
339341
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 ,
341343 & pooled -> vio );
342344 if (result != VDO_SUCCESS ) {
343345 free_vio_pool (pool );
0 commit comments