From eace70ea6a2aeedfa8c7c313efcb4e57f4702f32 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Thu, 21 Sep 2023 12:16:44 -0400 Subject: [PATCH] EX-8270 ptlrpc: rename npools to nptr_pages Continue removal of 'pool' as a name for a page of pointers to items in a pool. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I97b320027a0a6b5870d246e1527fa3fbe15fccb5 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52460 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/ptlrpc/sec_bulk.c | 56 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index c9d339e..d6e6df0 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -385,7 +385,7 @@ static int pool_shrink(struct shrinker *shrinker, struct shrink_control *sc) #endif /* HAVE_SHRINKER_COUNT */ static inline -int npages_to_npools(unsigned long npages) +int npages_to_nptr_pages(unsigned long npages) { return (int) ((npages + PTRS_PER_PAGE - 1) / PTRS_PER_PAGE); } @@ -393,13 +393,13 @@ int npages_to_npools(unsigned long npages) /* * return how many pages cleaned up. */ -static unsigned long pool_cleanup(void ***pools, int npools, +static unsigned long pool_cleanup(void ***pools, int nptr_pages, struct ptlrpc_page_pool *pool) { unsigned long cleaned = 0; int i, j; - for (i = 0; i < npools; i++) { + for (i = 0; i < nptr_pages; i++) { if (pools[i]) { for (j = 0; j < PTRS_PER_PAGE; j++) { if (pools[i][j]) { @@ -421,22 +421,22 @@ static unsigned long pool_cleanup(void ***pools, int npools, } /* - * merge @npools pointed by @pools which contains @npages new pages - * into current pools. + * merge @nptr_pages pointed by @pools which contains @npages new pages + * into current pool. * * we have options to avoid most memory copy with some tricks. but we choose * the simplest way to avoid complexity. It's not frequently called. */ -static void pool_insert(void ***pools, int npools, int npages, +static void pool_insert(void ***pools, int nptr_pages, int npages, struct ptlrpc_page_pool *page_pool) { int freeslot; int op_idx, np_idx, og_idx, ng_idx; - int cur_npools, end_npools; + int cur_nptr_page, end_nptr_page; LASSERT(npages > 0); LASSERT(page_pool->ppp_total_pages+npages <= page_pool->ppp_max_pages); - LASSERT(npages_to_npools(npages) == npools); + LASSERT(npages_to_nptr_pages(npages) == nptr_pages); LASSERT(page_pool->ppp_growing); spin_lock(&page_pool->ppp_lock); @@ -455,7 +455,7 @@ static void pool_insert(void ***pools, int npools, int npages, op_idx = page_pool->ppp_free_pages / PTRS_PER_PAGE; og_idx = page_pool->ppp_free_pages % PTRS_PER_PAGE; - np_idx = npools - 1; + np_idx = nptr_pages - 1; ng_idx = (npages - 1) % PTRS_PER_PAGE; while (freeslot) { @@ -482,26 +482,26 @@ static void pool_insert(void ***pools, int npools, int npages, /* * (2) add pools if needed. */ - cur_npools = (page_pool->ppp_total_pages + PTRS_PER_PAGE - 1) / + cur_nptr_page = (page_pool->ppp_total_pages + PTRS_PER_PAGE - 1) / PTRS_PER_PAGE; - end_npools = (page_pool->ppp_total_pages + npages + + end_nptr_page = (page_pool->ppp_total_pages + npages + PTRS_PER_PAGE - 1) / PTRS_PER_PAGE; - LASSERT(end_npools <= page_pool->ppp_max_ptr_pages); + LASSERT(end_nptr_page <= page_pool->ppp_max_ptr_pages); np_idx = 0; - while (cur_npools < end_npools) { - LASSERT(page_pool->ppp_ptr_pages[cur_npools] == NULL); - LASSERT(np_idx < npools); + while (cur_nptr_page < end_nptr_page) { + LASSERT(page_pool->ppp_ptr_pages[cur_nptr_page] == NULL); + LASSERT(np_idx < nptr_pages); LASSERT(pools[np_idx] != NULL); - page_pool->ppp_ptr_pages[cur_npools++] = pools[np_idx]; + page_pool->ppp_ptr_pages[cur_nptr_page++] = pools[np_idx]; pools[np_idx++] = NULL; } /* * (3) free useless source pools */ - while (np_idx < npools) { + while (np_idx < nptr_pages) { LASSERT(pools[np_idx] != NULL); CDEBUG(D_SEC, "Free useless pool buffer: %i, %p\n", np_idx, pools[np_idx]); @@ -526,7 +526,7 @@ static void pool_insert(void ***pools, int npools, int npages, static int pool_add_pages(int npages, struct ptlrpc_page_pool *page_pool) { void ***pools; - int npools, alloced = 0; + int nptr_pages, alloced = 0; int i, j, rc = -ENOMEM; unsigned int pool_order = page_pool->ppp_order; @@ -541,12 +541,12 @@ static int pool_add_pages(int npages, struct ptlrpc_page_pool *page_pool) page_pool->ppp_st_grows++; - npools = npages_to_npools(npages); - OBD_ALLOC_PTR_ARRAY(pools, npools); + nptr_pages = npages_to_nptr_pages(npages); + OBD_ALLOC_PTR_ARRAY(pools, nptr_pages); if (pools == NULL) goto out; - for (i = 0; i < npools; i++) { + for (i = 0; i < nptr_pages; i++) { OBD_ALLOC(pools[i], PAGE_SIZE); if (pools[i] == NULL) goto out_pools; @@ -567,14 +567,14 @@ static int pool_add_pages(int npages, struct ptlrpc_page_pool *page_pool) } LASSERT(alloced == npages); - pool_insert(pools, npools, npages, page_pool); + pool_insert(pools, nptr_pages, npages, page_pool); CDEBUG(D_SEC, "added %d pages into pools\n", npages); - OBD_FREE_PTR_ARRAY(pools, npools); + OBD_FREE_PTR_ARRAY(pools, nptr_pages); rc = 0; out_pools: if (rc) { - pool_cleanup(pools, npools, page_pool); + pool_cleanup(pools, nptr_pages, page_pool); } out: if (rc) { @@ -1037,7 +1037,7 @@ int sptlrpc_pool_init(void) pool->ppp_max_pages = pool_max_pages; pool->ppp_max_ptr_pages = - npages_to_npools(pool->ppp_max_pages); + npages_to_nptr_pages(pool->ppp_max_pages); init_waitqueue_head(&pool->ppp_waitq); pool->ppp_last_shrink = ktime_get_seconds(); @@ -1084,7 +1084,7 @@ fail: void sptlrpc_pool_fini(void) { - unsigned long cleaned, npools; + unsigned long cleaned, nptr_pages; int pool_order; struct ptlrpc_page_pool *pool; @@ -1094,8 +1094,8 @@ void sptlrpc_pool_fini(void) LASSERT(pool->ppp_ptr_pages); LASSERT(pool->ppp_total_pages == pool->ppp_free_pages); - npools = npages_to_npools(pool->ppp_total_pages); - cleaned = pool_cleanup(pool->ppp_ptr_pages, npools, pool); + nptr_pages = npages_to_nptr_pages(pool->ppp_total_pages); + cleaned = pool_cleanup(pool->ppp_ptr_pages, nptr_pages, pool); LASSERT(cleaned == pool->ppp_total_pages); pool_ptrs_free(pool); -- 1.8.3.1