From 861b3631b8dc66cca675845450c9e25616af1e05 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Wed, 20 Sep 2023 18:02:36 -0400 Subject: [PATCH] EX-8270 ptlrpc: make {get,put}_pages take order Pool index and pool order are now the same thing. Let's start by changing {get,put} pages, then we'll flow the change in to the rest of the code. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I1ad789b9c848a8ef601b21271d32fe0c2bb929c8 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52446 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/ptlrpc/sec_bulk.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index ad89637..f8c1f94 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -675,10 +675,10 @@ static bool __grow_pool_try(int needed, struct ptlrpc_page_pool *pool); * we allocate the requested pages atomically. */ static inline int __sptlrpc_pool_get_pages(void *array, unsigned int count, - unsigned int pool_idx, + unsigned int order, void **(*page_from)(void *, int)) { - struct ptlrpc_page_pool *page_pool = page_pools[pool_idx]; + struct ptlrpc_page_pool *page_pool = page_pools[order]; wait_queue_entry_t waitlink; unsigned long this_idle = -1; u64 tick_ns = 0; @@ -813,8 +813,8 @@ int sptlrpc_pool_get_desc_pages(struct ptlrpc_bulk_desc *desc) if (desc->bd_enc_vec == NULL) return -ENOMEM; - rc = __sptlrpc_pool_get_pages((void *)desc, desc->bd_iov_count, - PAGES_POOL, page_from_bulkdesc); + rc = __sptlrpc_pool_get_pages((void *)desc, desc->bd_iov_count, 0, + page_from_bulkdesc); if (rc) { OBD_FREE_LARGE(desc->bd_enc_vec, desc->bd_iov_count * @@ -827,8 +827,8 @@ EXPORT_SYMBOL(sptlrpc_pool_get_desc_pages); int sptlrpc_pool_get_pages_array(struct page **pa, unsigned int count) { - return __sptlrpc_pool_get_pages((void *)pa, count, PAGES_POOL, - page_from_pagearray); + return __sptlrpc_pool_get_pages((void *)pa, count, 0, + page_from_pagearray); } EXPORT_SYMBOL(sptlrpc_pool_get_pages_array); @@ -840,23 +840,23 @@ int sptlrpc_pool_get_pages(void **pages, unsigned int order) EXPORT_SYMBOL(sptlrpc_pool_get_pages); static int __sptlrpc_pool_put_pages(void *array, unsigned int count, - unsigned int pool_idx, - void **(*page_from)(void *, int)) + unsigned int order, + void **(*page_from)(void *, int)) { + struct ptlrpc_page_pool *page_pool; int p_idx, g_idx; int i, rc = 0; - struct ptlrpc_page_pool *page_pool; - LASSERTF(pool_idx < POOLS_COUNT, "count %u, pool %u\n", - count, pool_idx); + LASSERTF(order < POOLS_COUNT, "count %u, pool %u\n", + count, order); if (!array) { CERROR("Faled to put %u pages, from pool %u\n", - count, pool_idx); + count, order); return -EINVAL; } - page_pool = page_pools[pool_idx]; - LASSERTF(page_pool != NULL, "count %u, pool %u\n", count, pool_idx); + page_pool = page_pools[order]; + LASSERTF(page_pool != NULL, "count %u, pool %u\n", count, order); spin_lock(&page_pool->ppp_lock); @@ -897,8 +897,8 @@ void sptlrpc_pool_put_desc_pages(struct ptlrpc_bulk_desc *desc) if (desc->bd_enc_vec == NULL) return; - rc = __sptlrpc_pool_put_pages((void *)desc, desc->bd_iov_count, - PAGES_POOL, page_from_bulkdesc); + rc = __sptlrpc_pool_put_pages((void *)desc, desc->bd_iov_count, 0, + page_from_bulkdesc); if (rc) CDEBUG(D_SEC, "error putting pages in pool: %d\n", rc); @@ -911,7 +911,7 @@ void sptlrpc_pool_put_pages_array(struct page **pa, unsigned int count) { int rc; - rc = __sptlrpc_pool_put_pages((void *)pa, count, PAGES_POOL, + rc = __sptlrpc_pool_put_pages((void *)pa, count, 0, page_from_pagearray); if (rc) -- 1.8.3.1