Skip to content

Commit

Permalink
NFS: Get rid of the nfs_rdata_mempool
Browse files Browse the repository at this point in the history
We don't need a mempool in order to guarantee reliable NFS read performance.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 19, 2011
1 parent fba7300 commit b6ee8cd
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions fs/nfs/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,21 @@ static const struct rpc_call_ops nfs_read_partial_ops;
static const struct rpc_call_ops nfs_read_full_ops;

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 *p = mempool_alloc(nfs_rdata_mempool, GFP_KERNEL);
struct nfs_read_data *p;

p = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL);
if (p) {
memset(p, 0, sizeof(*p));
INIT_LIST_HEAD(&p->pages);
p->npages = pagecount;
if (pagecount <= ARRAY_SIZE(p->page_array))
p->pagevec = p->page_array;
else {
p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);
if (!p->pagevec) {
mempool_free(p, nfs_rdata_mempool);
kmem_cache_free(nfs_rdata_cachep, p);
p = NULL;
}
}
Expand All @@ -64,7 +61,7 @@ void nfs_readdata_free(struct nfs_read_data *p)
{
if (p && (p->pagevec != &p->page_array[0]))
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)
Expand Down Expand Up @@ -716,16 +713,10 @@ int __init nfs_init_readpagecache(void)
if (nfs_rdata_cachep == NULL)
return -ENOMEM;

nfs_rdata_mempool = mempool_create_slab_pool(MIN_POOL_READ,
nfs_rdata_cachep);
if (nfs_rdata_mempool == NULL)
return -ENOMEM;

return 0;
}

void nfs_destroy_readpagecache(void)
{
mempool_destroy(nfs_rdata_mempool);
kmem_cache_destroy(nfs_rdata_cachep);
}

0 comments on commit b6ee8cd

Please sign in to comment.