* 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;
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 *
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);
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);
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);
{
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)