From: Ken Raeburn <[email protected]>

Signed-off-by: Ken Raeburn <[email protected]>
Signed-off-by: Matthew Sakai <[email protected]>
---
 drivers/md/dm-vdo/block-map.c  |  2 +-
 drivers/md/dm-vdo/slab-depot.c |  2 +-
 drivers/md/dm-vdo/vio.c        | 10 ++++++----
 drivers/md/dm-vdo/vio.h        |  7 ++++---
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c
index bc836f95f8b5..1f7cdd837ff9 100644
--- a/drivers/md/dm-vdo/block-map.c
+++ b/drivers/md/dm-vdo/block-map.c
@@ -2745,7 +2745,7 @@ static int __must_check initialize_block_map_zone(struct 
block_map *map,
        if (result != VDO_SUCCESS)
                return result;
 
-       result = make_vio_pool(vdo, BLOCK_MAP_VIO_POOL_SIZE,
+       result = make_vio_pool(vdo, BLOCK_MAP_VIO_POOL_SIZE, 1,
                               zone->thread_id, VIO_TYPE_BLOCK_MAP_INTERIOR,
                               VIO_PRIORITY_METADATA, zone, &zone->vio_pool);
        if (result != VDO_SUCCESS)
diff --git a/drivers/md/dm-vdo/slab-depot.c b/drivers/md/dm-vdo/slab-depot.c
index a556cd5831c1..92d1d827800f 100644
--- a/drivers/md/dm-vdo/slab-depot.c
+++ b/drivers/md/dm-vdo/slab-depot.c
@@ -4007,7 +4007,7 @@ static int __must_check initialize_block_allocator(struct 
slab_depot *depot,
                return result;
 
        vdo_initialize_completion(&allocator->completion, vdo, 
VDO_BLOCK_ALLOCATOR_COMPLETION);
-       result = make_vio_pool(vdo, BLOCK_ALLOCATOR_VIO_POOL_SIZE, 
allocator->thread_id,
+       result = make_vio_pool(vdo, BLOCK_ALLOCATOR_VIO_POOL_SIZE, 1, 
allocator->thread_id,
                               VIO_TYPE_SLAB_JOURNAL, VIO_PRIORITY_METADATA,
                               allocator, &allocator->vio_pool);
        if (result != VDO_SUCCESS)
diff --git a/drivers/md/dm-vdo/vio.c b/drivers/md/dm-vdo/vio.c
index 4d96989a716d..f69fb74a238c 100644
--- a/drivers/md/dm-vdo/vio.c
+++ b/drivers/md/dm-vdo/vio.c
@@ -301,6 +301,7 @@ void vio_record_metadata_io_error(struct vio *vio)
  * make_vio_pool() - Create a new vio pool.
  * @vdo: The vdo.
  * @pool_size: The number of vios in the pool.
+ * @block_count: The number of 4k blocks per vio.
  * @thread_id: The ID of the thread using this pool.
  * @vio_type: The type of vios in the pool.
  * @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)
  *
  * Return: A success or error code.
  */
-int make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t thread_id,
+int make_vio_pool(struct vdo *vdo, size_t pool_size, size_t block_count, 
thread_id_t thread_id,
                  enum vio_type vio_type, enum vio_priority priority, void 
*context,
                  struct vio_pool **pool_ptr)
 {
        struct vio_pool *pool;
        char *ptr;
        int result;
+       size_t per_vio_size = VDO_BLOCK_SIZE * block_count;
 
        result = vdo_allocate_extended(struct vio_pool, pool_size, struct 
pooled_vio,
                                       __func__, &pool);
@@ -326,7 +328,7 @@ int make_vio_pool(struct vdo *vdo, size_t pool_size, 
thread_id_t thread_id,
        INIT_LIST_HEAD(&pool->available);
        INIT_LIST_HEAD(&pool->busy);
 
-       result = vdo_allocate(pool_size * VDO_BLOCK_SIZE, char,
+       result = vdo_allocate(pool_size * per_vio_size, char,
                              "VIO pool buffer", &pool->buffer);
        if (result != VDO_SUCCESS) {
                free_vio_pool(pool);
@@ -334,10 +336,10 @@ int make_vio_pool(struct vdo *vdo, size_t pool_size, 
thread_id_t thread_id,
        }
 
        ptr = pool->buffer;
-       for (pool->size = 0; pool->size < pool_size; pool->size++, ptr += 
VDO_BLOCK_SIZE) {
+       for (pool->size = 0; pool->size < pool_size; pool->size++, ptr += 
per_vio_size) {
                struct pooled_vio *pooled = &pool->vios[pool->size];
 
-               result = allocate_vio_components(vdo, vio_type, priority, NULL, 
1, ptr,
+               result = allocate_vio_components(vdo, vio_type, priority, NULL, 
block_count, ptr,
                                                 &pooled->vio);
                if (result != VDO_SUCCESS) {
                        free_vio_pool(pool);
diff --git a/drivers/md/dm-vdo/vio.h b/drivers/md/dm-vdo/vio.h
index 2e3f878e2074..8a7e3f72e80b 100644
--- a/drivers/md/dm-vdo/vio.h
+++ b/drivers/md/dm-vdo/vio.h
@@ -190,9 +190,10 @@ static inline struct pooled_vio *vio_as_pooled_vio(struct 
vio *vio)
 
 struct vio_pool;
 
-int __must_check make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t 
thread_id,
-                              enum vio_type vio_type, enum vio_priority 
priority,
-                              void *context, struct vio_pool **pool_ptr);
+int __must_check make_vio_pool(struct vdo *vdo, size_t pool_size, size_t 
block_count,
+                              thread_id_t thread_id, enum vio_type vio_type,
+                              enum vio_priority priority, void *context,
+                              struct vio_pool **pool_ptr);
 void free_vio_pool(struct vio_pool *pool);
 bool __must_check is_vio_pool_busy(struct vio_pool *pool);
 void acquire_vio_from_pool(struct vio_pool *pool, struct vdo_waiter *waiter);
-- 
2.45.2


Reply via email to