* 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;
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)
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 >
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.
*/
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);
}
page_pool->epp_free_pages += count;
- enc_pools_wakeup(pool);
+ enc_pools_wakeup(pool_idx);
out_unlock:
spin_unlock(&page_pool->epp_lock);