aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 8f1eb08ccffa..e9dbdc8eafe6 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -153,6 +153,16 @@ static void nfs_readpage_release(struct nfs_page *req)
153 nfs_release_request(req); 153 nfs_release_request(req);
154} 154}
155 155
156static void nfs_execute_read(struct nfs_read_data *data)
157{
158 struct rpc_clnt *clnt = NFS_CLIENT(data->inode);
159 sigset_t oldset;
160
161 rpc_clnt_sigmask(clnt, &oldset);
162 rpc_execute(&data->task);
163 rpc_clnt_sigunmask(clnt, &oldset);
164}
165
156/* 166/*
157 * Set up the NFS read request struct 167 * Set up the NFS read request struct
158 */ 168 */
@@ -162,8 +172,14 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
162{ 172{
163 struct inode *inode = req->wb_context->path.dentry->d_inode; 173 struct inode *inode = req->wb_context->path.dentry->d_inode;
164 int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; 174 int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
175 struct rpc_message msg = {
176 .rpc_argp = &data->args,
177 .rpc_resp = &data->res,
178 .rpc_cred = req->wb_context->cred,
179 };
165 struct rpc_task_setup task_setup_data = { 180 struct rpc_task_setup task_setup_data = {
166 .rpc_client = NFS_CLIENT(inode), 181 .rpc_client = NFS_CLIENT(inode),
182 .rpc_message = &msg,
167 .callback_ops = call_ops, 183 .callback_ops = call_ops,
168 .callback_data = data, 184 .callback_data = data,
169 .flags = RPC_TASK_ASYNC | swap_flags, 185 .flags = RPC_TASK_ASYNC | swap_flags,
@@ -171,7 +187,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
171 187
172 data->req = req; 188 data->req = req;
173 data->inode = inode; 189 data->inode = inode;
174 data->cred = req->wb_context->cred; 190 data->cred = msg.rpc_cred;
175 191
176 data->args.fh = NFS_FH(inode); 192 data->args.fh = NFS_FH(inode);
177 data->args.offset = req_offset(req) + offset; 193 data->args.offset = req_offset(req) + offset;
@@ -186,8 +202,8 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
186 nfs_fattr_init(&data->fattr); 202 nfs_fattr_init(&data->fattr);
187 203
188 /* Set up the initial task struct. */ 204 /* Set up the initial task struct. */
205 NFS_PROTO(inode)->read_setup(data, &msg);
189 rpc_init_task(&data->task, &task_setup_data); 206 rpc_init_task(&data->task, &task_setup_data);
190 NFS_PROTO(inode)->read_setup(data);
191 207
192 dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n", 208 dprintk("NFS: %5u initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
193 data->task.tk_pid, 209 data->task.tk_pid,
@@ -195,6 +211,8 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
195 (long long)NFS_FILEID(inode), 211 (long long)NFS_FILEID(inode),
196 count, 212 count,
197 (unsigned long long)data->args.offset); 213 (unsigned long long)data->args.offset);
214
215 nfs_execute_read(data);
198} 216}
199 217
200static void 218static void
@@ -211,19 +229,6 @@ nfs_async_read_error(struct list_head *head)
211} 229}
212 230
213/* 231/*
214 * Start an async read operation
215 */
216static void nfs_execute_read(struct nfs_read_data *data)
217{
218 struct rpc_clnt *clnt = NFS_CLIENT(data->inode);
219 sigset_t oldset;
220
221 rpc_clnt_sigmask(clnt, &oldset);
222 rpc_execute(&data->task);
223 rpc_clnt_sigunmask(clnt, &oldset);
224}
225
226/*
227 * Generate multiple requests to fill a single page. 232 * Generate multiple requests to fill a single page.
228 * 233 *
229 * We optimize to reduce the number of read operations on the wire. If we 234 * We optimize to reduce the number of read operations on the wire. If we
@@ -277,7 +282,6 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
277 rsize, offset); 282 rsize, offset);
278 offset += rsize; 283 offset += rsize;
279 nbytes -= rsize; 284 nbytes -= rsize;
280 nfs_execute_read(data);
281 } while (nbytes != 0); 285 } while (nbytes != 0);
282 286
283 return 0; 287 return 0;
@@ -315,8 +319,6 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned
315 req = nfs_list_entry(data->pages.next); 319 req = nfs_list_entry(data->pages.next);
316 320
317 nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0); 321 nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0);
318
319 nfs_execute_read(data);
320 return 0; 322 return 0;
321out_bad: 323out_bad:
322 nfs_async_read_error(head); 324 nfs_async_read_error(head);