Commit b6ee8cd2 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Get rid of the nfs_rdata_mempool

We don't need a mempool in order to guarantee reliable NFS read performance.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent fba73005
...@@ -35,16 +35,13 @@ static const struct rpc_call_ops nfs_read_partial_ops; ...@@ -35,16 +35,13 @@ static const struct rpc_call_ops nfs_read_partial_ops;
static const struct rpc_call_ops nfs_read_full_ops; static const struct rpc_call_ops nfs_read_full_ops;
static struct kmem_cache *nfs_rdata_cachep; static struct kmem_cache *nfs_rdata_cachep;
static mempool_t *nfs_rdata_mempool;
#define MIN_POOL_READ (32)
struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
{ {
struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, GFP_KERNEL); struct nfs_read_data *p;
p = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL);
if (p) { if (p) {
memset(p, 0, sizeof(*p));
INIT_LIST_HEAD(&p->pages); INIT_LIST_HEAD(&p->pages);
p->npages = pagecount; p->npages = pagecount;
if (pagecount <= ARRAY_SIZE(p->page_array)) if (pagecount <= ARRAY_SIZE(p->page_array))
...@@ -52,7 +49,7 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) ...@@ -52,7 +49,7 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
else { else {
p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL); p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);
if (!p->pagevec) { if (!p->pagevec) {
mempool_free(p, nfs_rdata_mempool); kmem_cache_free(nfs_rdata_cachep, p);
p = NULL; p = NULL;
} }
} }
...@@ -64,7 +61,7 @@ void nfs_readdata_free(struct nfs_read_data *p) ...@@ -64,7 +61,7 @@ void nfs_readdata_free(struct nfs_read_data *p)
{ {
if (p && (p->pagevec != &p->page_array[0])) if (p && (p->pagevec != &p->page_array[0]))
kfree(p->pagevec); kfree(p->pagevec);
mempool_free(p, nfs_rdata_mempool); kmem_cache_free(nfs_rdata_cachep, p);
} }
void nfs_readdata_release(struct nfs_read_data *rdata) void nfs_readdata_release(struct nfs_read_data *rdata)
...@@ -716,16 +713,10 @@ int __init nfs_init_readpagecache(void) ...@@ -716,16 +713,10 @@ int __init nfs_init_readpagecache(void)
if (nfs_rdata_cachep == NULL) if (nfs_rdata_cachep == NULL)
return -ENOMEM; return -ENOMEM;
nfs_rdata_mempool = mempool_create_slab_pool(MIN_POOL_READ,
nfs_rdata_cachep);
if (nfs_rdata_mempool == NULL)
return -ENOMEM;
return 0; return 0;
} }
void nfs_destroy_readpagecache(void) void nfs_destroy_readpagecache(void)
{ {
mempool_destroy(nfs_rdata_mempool);
kmem_cache_destroy(nfs_rdata_cachep); kmem_cache_destroy(nfs_rdata_cachep);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment