Whamcloud - gitweb
EX-8270 ptlrpc: rename 'pool' to 'pool_idx'
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 15 Sep 2023 17:36:20 +0000 (13:36 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 22 Sep 2023 23:52:45 +0000 (23:52 +0000)
'pool' here is the index of the pool, not the pool itself.
Let's give it a name that makes clear it's a number and not
the actual pool.

Also remove an error condition which is asserted on
immediately before.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I636a4756a033d0b96a4772b8912f61c4b31b9c64
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52426
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/ptlrpc/sec_bulk.c

index 8f923ac..6d3c31d 100644 (file)
@@ -667,10 +667,10 @@ static inline void **page_from_bufarray(void *array, int index)
  * we allocate the requested pages atomically.
  */
 static inline int __sptlrpc_enc_pool_get_pages(void *array, unsigned int count,
-                                       unsigned int pool,
-                                       void **(*page_from)(void *, int))
+                                              unsigned int pool_idx,
+                                             void **(*page_from)(void *, int))
 {
-       struct ptlrpc_enc_page_pool *page_pool = page_pools[pool];
+       struct ptlrpc_enc_page_pool *page_pool = page_pools[pool_idx];
        wait_queue_entry_t waitlink;
        unsigned long this_idle = -1;
        u64 tick_ns = 0;
@@ -678,7 +678,7 @@ static inline int __sptlrpc_enc_pool_get_pages(void *array, unsigned int count,
        int p_idx, g_idx;
        int i, rc = 0;
 
-       if (pool)
+       if (pool_idx)
                count = 1;
 
        if (!array || count <= 0 || count > page_pool->epp_max_pages)
@@ -697,17 +697,18 @@ again:
                page_pool->epp_st_missings++;
                page_pool->epp_pages_short += count;
 
-               if (enc_pools_should_grow(count, now, pool)) {
+               if (enc_pools_should_grow(count, now, pool_idx)) {
                        page_pool->epp_growing = 1;
 
                        spin_unlock(&page_pool->epp_lock);
-                       CDEBUG(D_SEC, "epp_pages_short: %lu\n", page_pool->epp_pages_short);
-                       enc_pools_add_pages(8, pool);
+                       CDEBUG(D_SEC, "epp_pages_short: %lu\n",
+                              page_pool->epp_pages_short);
+                       enc_pools_add_pages(8, pool_idx);
                        spin_lock(&page_pool->epp_lock);
 
                        page_pool->epp_growing = 0;
 
-                       enc_pools_wakeup(pool);
+                       enc_pools_wakeup(pool_idx);
                } else {
                        if (page_pool->epp_growing) {
                                if (++page_pool->epp_waitqlen >
@@ -728,8 +729,8 @@ again:
                                page_pool->epp_waitqlen--;
                        } else {
                                /*
-                                * ptlrpcd thread should not sleep in that case,
-                                * or deadlock may occur!
+                                * ptlrpcd thread should not sleep in that
+                                * case or deadlock may occur!
                                 * Instead, return -ENOMEM so that upper layers
                                 * will put request back in queue.
                                 */
@@ -840,21 +841,23 @@ int sptlrpc_enc_pool_get_buf(void **buf, unsigned int size_bits)
 EXPORT_SYMBOL(sptlrpc_enc_pool_get_buf);
 
 static int __sptlrpc_enc_pool_put_pages(void *array, unsigned int count,
-                                       unsigned int pool,
+                                       unsigned int pool_idx,
                                        void **(*page_from)(void *, int))
 {
        int p_idx, g_idx;
        int i, rc = 0;
        struct ptlrpc_enc_page_pool *page_pool;
 
-       LASSERTF(pool < POOLS_COUNT, "count %u, pool %u\n", count, pool);
-       if (!array || pool >= POOLS_COUNT) {
-               CERROR("Faled to put %u pages, from pull %u\n", count, pool);
+       LASSERTF(pool_idx < POOLS_COUNT, "count %u, pool %u\n",
+                count, pool_idx);
+       if (!array) {
+               CERROR("Faled to put %u pages, from pool %u\n",
+                      count, pool_idx);
                return -EINVAL;
        }
 
-       page_pool = page_pools[pool];
-       LASSERTF(page_pool != NULL, "count %u, pool %u\n", count, pool);
+       page_pool = page_pools[pool_idx];
+       LASSERTF(page_pool != NULL, "count %u, pool %u\n", count, pool_idx);
 
        spin_lock(&page_pool->epp_lock);
 
@@ -881,7 +884,7 @@ static int __sptlrpc_enc_pool_put_pages(void *array, unsigned int count,
        }
 
        page_pool->epp_free_pages += count;
-       enc_pools_wakeup(pool);
+       enc_pools_wakeup(pool_idx);
 
 out_unlock:
        spin_unlock(&page_pool->epp_lock);