aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:37 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:37 -0500
commit3feb2d49394b7874348a6e43c076b780c1d222c5 (patch)
tree6d27d4170fd9435574bd804033793f9d0d69a355 /fs/nfs/read.c
parent5db3a7b2cabe8f0957683f798c4f8fa8605f9ebb (diff)
NFS: Uninline nfs_writedata_(alloc|free) and nfs_readdata_(alloc|free)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 2da255f0247f..3961524fd4ab 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -40,10 +40,40 @@ static const struct rpc_call_ops nfs_read_partial_ops;
40static const struct rpc_call_ops nfs_read_full_ops; 40static const struct rpc_call_ops nfs_read_full_ops;
41 41
42static kmem_cache_t *nfs_rdata_cachep; 42static kmem_cache_t *nfs_rdata_cachep;
43mempool_t *nfs_rdata_mempool; 43static mempool_t *nfs_rdata_mempool;
44 44
45#define MIN_POOL_READ (32) 45#define MIN_POOL_READ (32)
46 46
47struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
48{
49 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
50
51 if (p) {
52 memset(p, 0, sizeof(*p));
53 INIT_LIST_HEAD(&p->pages);
54 if (pagecount < NFS_PAGEVEC_SIZE)
55 p->pagevec = &p->page_array[0];
56 else {
57 size_t size = ++pagecount * sizeof(struct page *);
58 p->pagevec = kmalloc(size, GFP_NOFS);
59 if (p->pagevec) {
60 memset(p->pagevec, 0, size);
61 } else {
62 mempool_free(p, nfs_rdata_mempool);
63 p = NULL;
64 }
65 }
66 }
67 return p;
68}
69
70void nfs_readdata_free(struct nfs_read_data *p)
71{
72 if (p && (p->pagevec != &p->page_array[0]))
73 kfree(p->pagevec);
74 mempool_free(p, nfs_rdata_mempool);
75}
76
47void nfs_readdata_release(void *data) 77void nfs_readdata_release(void *data)
48{ 78{
49 nfs_readdata_free(data); 79 nfs_readdata_free(data);