aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.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/write.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/write.c')
-rw-r--r--fs/nfs/write.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f7c8be0beccf..647e3217c2e1 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -86,7 +86,7 @@ static const struct rpc_call_ops nfs_write_full_ops;
86static const struct rpc_call_ops nfs_commit_ops; 86static const struct rpc_call_ops nfs_commit_ops;
87 87
88static kmem_cache_t *nfs_wdata_cachep; 88static kmem_cache_t *nfs_wdata_cachep;
89mempool_t *nfs_wdata_mempool; 89static mempool_t *nfs_wdata_mempool;
90static mempool_t *nfs_commit_mempool; 90static mempool_t *nfs_commit_mempool;
91 91
92static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); 92static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);
@@ -119,6 +119,36 @@ void nfs_commit_free(struct nfs_write_data *p)
119 mempool_free(p, nfs_commit_mempool); 119 mempool_free(p, nfs_commit_mempool);
120} 120}
121 121
122struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
123{
124 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
125
126 if (p) {
127 memset(p, 0, sizeof(*p));
128 INIT_LIST_HEAD(&p->pages);
129 if (pagecount < NFS_PAGEVEC_SIZE)
130 p->pagevec = &p->page_array[0];
131 else {
132 size_t size = ++pagecount * sizeof(struct page *);
133 p->pagevec = kmalloc(size, GFP_NOFS);
134 if (p->pagevec) {
135 memset(p->pagevec, 0, size);
136 } else {
137 mempool_free(p, nfs_wdata_mempool);
138 p = NULL;
139 }
140 }
141 }
142 return p;
143}
144
145void nfs_writedata_free(struct nfs_write_data *p)
146{
147 if (p && (p->pagevec != &p->page_array[0]))
148 kfree(p->pagevec);
149 mempool_free(p, nfs_wdata_mempool);
150}
151
122void nfs_writedata_release(void *wdata) 152void nfs_writedata_release(void *wdata)
123{ 153{
124 nfs_writedata_free(wdata); 154 nfs_writedata_free(wdata);