Skip to content

Commit 979a0fd

Browse files
raeburnMikulas Patocka
authored andcommitted
dm vdo vio-pool: support pools with multiple data blocks per vio
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>
1 parent 2b515ce commit 979a0fd

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

drivers/md/dm-vdo/block-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,7 @@ static int __must_check initialize_block_map_zone(struct block_map *map,
27452745
if (result != VDO_SUCCESS)
27462746
return result;
27472747

2748-
result = make_vio_pool(vdo, BLOCK_MAP_VIO_POOL_SIZE,
2748+
result = make_vio_pool(vdo, BLOCK_MAP_VIO_POOL_SIZE, 1,
27492749
zone->thread_id, VIO_TYPE_BLOCK_MAP_INTERIOR,
27502750
VIO_PRIORITY_METADATA, zone, &zone->vio_pool);
27512751
if (result != VDO_SUCCESS)

drivers/md/dm-vdo/slab-depot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,7 @@ static int __must_check initialize_block_allocator(struct slab_depot *depot,
39993999
return result;
40004000

40014001
vdo_initialize_completion(&allocator->completion, vdo, VDO_BLOCK_ALLOCATOR_COMPLETION);
4002-
result = make_vio_pool(vdo, BLOCK_ALLOCATOR_VIO_POOL_SIZE, allocator->thread_id,
4002+
result = make_vio_pool(vdo, BLOCK_ALLOCATOR_VIO_POOL_SIZE, 1, allocator->thread_id,
40034003
VIO_TYPE_SLAB_JOURNAL, VIO_PRIORITY_METADATA,
40044004
allocator, &allocator->vio_pool);
40054005
if (result != VDO_SUCCESS)

drivers/md/dm-vdo/vio.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

drivers/md/dm-vdo/vio.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ static inline struct pooled_vio *vio_as_pooled_vio(struct vio *vio)
190190

191191
struct vio_pool;
192192

193-
int __must_check make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t thread_id,
194-
enum vio_type vio_type, enum vio_priority priority,
195-
void *context, struct vio_pool **pool_ptr);
193+
int __must_check make_vio_pool(struct vdo *vdo, size_t pool_size, size_t block_count,
194+
thread_id_t thread_id, enum vio_type vio_type,
195+
enum vio_priority priority, void *context,
196+
struct vio_pool **pool_ptr);
196197
void free_vio_pool(struct vio_pool *pool);
197198
bool __must_check is_vio_pool_busy(struct vio_pool *pool);
198199
void acquire_vio_from_pool(struct vio_pool *pool, struct vdo_waiter *waiter);

0 commit comments

Comments
 (0)