summaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-30 18:31:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-30 18:31:49 -0400
commit292f3eeef00a20fa0ef4feec62792ad0065760a0 (patch)
tree1bf0ff03bada0f78f214dddaf327a4c406bc5990 /fs/nfs/direct.c
parent6d74743b088d116e31fe1b73f47e782ee2016b94 (diff)
NFS: Use kmem_cache_zalloc() in nfs_direct_req_alloc
Simplify the initialisation of O_DIRECT requests. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 78d1ead8bc30..f17e4695c842 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -149,26 +149,16 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void)
149{ 149{
150 struct nfs_direct_req *dreq; 150 struct nfs_direct_req *dreq;
151 151
152 dreq = kmem_cache_alloc(nfs_direct_cachep, GFP_KERNEL); 152 dreq = kmem_cache_zalloc(nfs_direct_cachep, GFP_KERNEL);
153 if (!dreq) 153 if (!dreq)
154 return NULL; 154 return NULL;
155 155
156 kref_init(&dreq->kref); 156 kref_init(&dreq->kref);
157 kref_get(&dreq->kref); 157 kref_get(&dreq->kref);
158 init_completion(&dreq->completion); 158 init_completion(&dreq->completion);
159 dreq->mds_cinfo.ncommit = 0;
160 atomic_set(&dreq->mds_cinfo.rpcs_out, 0);
161 INIT_LIST_HEAD(&dreq->mds_cinfo.list); 159 INIT_LIST_HEAD(&dreq->mds_cinfo.list);
162 INIT_WORK(&dreq->work, nfs_direct_write_schedule_work); 160 INIT_WORK(&dreq->work, nfs_direct_write_schedule_work);
163 memset(&dreq->ds_cinfo, 0, sizeof(dreq->ds_cinfo));
164 dreq->iocb = NULL;
165 dreq->ctx = NULL;
166 dreq->l_ctx = NULL;
167 spin_lock_init(&dreq->lock); 161 spin_lock_init(&dreq->lock);
168 atomic_set(&dreq->io_count, 0);
169 dreq->count = 0;
170 dreq->error = 0;
171 dreq->flags = 0;
172 162
173 return dreq; 163 return dreq;
174} 164}