]> www.infradead.org Git - linux.git/commitdiff
dm vdo vio-pool: support pools with multiple data blocks per vio
authorKen Raeburn <raeburn@redhat.com>
Sat, 1 Feb 2025 02:18:04 +0000 (21:18 -0500)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 3 Feb 2025 13:15:08 +0000 (14:15 +0100)
Support pools with multiple data blocks per vio

Signed-off-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-vdo/block-map.c
drivers/md/dm-vdo/slab-depot.c
drivers/md/dm-vdo/vio.c
drivers/md/dm-vdo/vio.h

index bc836f95f8b51f0884845e127cf81c022a540104..1f7cdd837ff93fd89bbaa9e5967c633da04ed37d 100644 (file)
@@ -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)
index 7249b281f99f8f06de5b8337fd3281f02c4a74f9..aca11271d66e7ba2d8754d6bdbbb7715a75f9937 100644 (file)
@@ -3999,7 +3999,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)
index 4d96989a716d8b0b532489f22c36d81297396d3c..f69fb74a238c795dc48e0217330b4de4ebcd2530 100644 (file)
@@ -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);
index 2e3f878e2074d637988dce0d1fa51613cfc407cc..8a7e3f72e80b424792f6ca9c5f747c7a838dfa1a 100644 (file)
@@ -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);