From: Patrick Farrell Date: Thu, 21 Sep 2023 15:15:12 +0000 (-0400) Subject: EX-8270 ptlrpc: remove PAGES_POOL macro X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5f496bb3f44aefdd91db452a65dd50ae6653600e;p=fs%2Flustre-release.git EX-8270 ptlrpc: remove PAGES_POOL macro PAGES_POOL is just the order 0 pool now, so remove the special naming, and adjust a few associated functions. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I09e1debeadecbce33c7be43a8859815084623358 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52456 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 2cd0179..054e32e 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -1163,7 +1163,6 @@ int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp, struct ptlrpc_cli_ctx *ctx); /* bulk security api */ -#define PAGES_POOL 0 void sptlrpc_pool_add_user(void); void sptlrpc_pool_del_user(void); int sptlrpc_pool_get_desc_pages(struct ptlrpc_bulk_desc *desc); @@ -1172,8 +1171,8 @@ int sptlrpc_pool_get_pages(void **buf, unsigned int order); void sptlrpc_pool_put_desc_pages(struct ptlrpc_bulk_desc *desc); void sptlrpc_pool_put_pages_array(struct page **pa, unsigned int count); void sptlrpc_pool_put_pages(void *buf, unsigned int order); -int sptlrpc_pool_get_free_pages(unsigned int pool); -int pool_is_at_full_capacity(void); +int sptlrpc_pool_get_free_pages(unsigned int order); +int pool_is_at_full_capacity(int order); int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 111ac32..a7f5f37 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1652,11 +1652,11 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) ENTRY; LASSERT(req->rq_phase == RQ_PHASE_NEW); - /* do not try to go further if there is not enough memory in enc_pool */ + /* do not try to go further if there is not enough memory in pool */ if (req->rq_sent && req->rq_bulk) if (req->rq_bulk->bd_iov_count > - sptlrpc_pool_get_free_pages(PAGES_POOL) && - pool_is_at_full_capacity()) + sptlrpc_pool_get_free_pages(0) && + pool_is_at_full_capacity(0)) RETURN(-ENOMEM); if (req->rq_sent && (req->rq_sent > ktime_get_real_seconds()) && diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index 9b757e5..619b5f6 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -145,7 +145,7 @@ static int element_size(struct ptlrpc_page_pool *pool) */ int encrypt_page_pools_seq_show(struct seq_file *m, void *v) { - struct ptlrpc_page_pool *pool = page_pools[PAGES_POOL]; + struct ptlrpc_page_pool *pool = page_pools[0]; spin_lock(&pool->ppp_lock); seq_printf(m, "physical pages: %lu\n" @@ -279,7 +279,7 @@ static void pool_release_free_pages(long npages, struct ptlrpc_page_pool *pool) LASSERT(pool->ppp_pools[p_idx]); LASSERT(pool->ppp_pools[p_idx][g_idx] != NULL); - if (pool->ppp_order == PAGES_POOL) + if (pool->ppp_order == 0) __free_page(pool->ppp_pools[p_idx][g_idx]); else OBD_FREE_LARGE(pool->ppp_pools[p_idx][g_idx], @@ -404,7 +404,7 @@ static unsigned long pool_cleanup(void ***pools, int npools, if (pools[i]) { for (j = 0; j < PAGES_PER_POOL; j++) { if (pools[i][j]) { - if (pool->ppp_order == PAGES_POOL) { + if (pool->ppp_order == 0) { __free_page(pools[i][j]); } else { OBD_FREE_LARGE(pools[i][j], @@ -553,7 +553,7 @@ static int pool_add_pages(int npages, struct ptlrpc_page_pool *page_pool) goto out_pools; for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) { - if (pool_order == PAGES_POOL) + if (pool_order == 0) pools[i][j] = alloc_page(GFP_NOFS | __GFP_HIGHMEM); else { @@ -625,29 +625,21 @@ static int pool_should_grow(int needed, struct ptlrpc_page_pool *pool) } /* - * Export the number of free pages in the pool + * Export the number of free pages in the pool of 'order' */ -int sptlrpc_pool_get_free_pages(unsigned int pool) +int sptlrpc_pool_get_free_pages(unsigned int order) { - return page_pools[pool]->ppp_free_pages; + return page_pools[order]->ppp_free_pages; } EXPORT_SYMBOL(sptlrpc_pool_get_free_pages); /* * Let outside world know if pool full capacity is reached */ -int __pool_is_at_full_capacity(unsigned int pool) +int pool_is_at_full_capacity(int order) { - return (page_pools[pool]->ppp_total_pages == - page_pools[pool]->ppp_max_pages); -} - -/* - * Let outside world know if pool full capacity is reached - */ -int pool_is_at_full_capacity(void) -{ - return __pool_is_at_full_capacity(PAGES_POOL); + return (page_pools[order]->ppp_total_pages == + page_pools[order]->ppp_max_pages); } EXPORT_SYMBOL(pool_is_at_full_capacity); @@ -803,7 +795,7 @@ int sptlrpc_pool_get_desc_pages(struct ptlrpc_bulk_desc *desc) int rc; LASSERT(desc->bd_iov_count > 0); - LASSERT(desc->bd_iov_count <= page_pools[PAGES_POOL]->ppp_max_pages); + LASSERT(desc->bd_iov_count <= page_pools[0]->ppp_max_pages); /* resent bulk, enc iov might have been allocated previously */ if (desc->bd_enc_vec != NULL) @@ -945,7 +937,7 @@ static bool __grow_pool_try(int needed, struct ptlrpc_page_pool *pool) /* the pool of single pages is grown a large amount on * first use */ - if (pool->ppp_order == PAGES_POOL && + if (pool->ppp_order == 0 && pool->ppp_total_pages == 0) to_add = PTLRPC_MAX_BRW_PAGES * 2; else /* otherwise, we add requested or at least 8 items */ @@ -987,7 +979,7 @@ static bool grow_pool_try(int needed, struct ptlrpc_page_pool *pool) */ void sptlrpc_pool_add_user(void) { - struct ptlrpc_page_pool *pool = page_pools[PAGES_POOL]; + struct ptlrpc_page_pool *pool = page_pools[0]; /* since this is startup, no one is waiting for these pages, so we * don't worry about sucess or failure here