aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-05-06 09:12:34 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 18:40:56 -0400
commitce59515c1484d3a01bc2f3e7043dc488d25efe34 (patch)
tree00c371ca81a26280eab34ad96fae8ca9c95d940d /fs/nfs/pagelist.c
parent6f92fa4581f1c26562f80dc686b3c9ea76556911 (diff)
NFS: Create a common rpcsetup function for reads and writes
Write adds a little bit of code dealing with flush flags, but since "how" will always be 0 when reading we can share the code. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index aabff78dc6e5..0ccd95116968 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -389,6 +389,50 @@ void nfs_pgio_data_release(struct nfs_pgio_data *data)
389EXPORT_SYMBOL_GPL(nfs_pgio_data_release); 389EXPORT_SYMBOL_GPL(nfs_pgio_data_release);
390 390
391/** 391/**
392 * nfs_pgio_rpcsetup - Set up arguments for a pageio call
393 * @data: The pageio data
394 * @count: Number of bytes to read
395 * @offset: Initial offset
396 * @how: How to commit data (writes only)
397 * @cinfo: Commit information for the call (writes only)
398 */
399void nfs_pgio_rpcsetup(struct nfs_pgio_data *data,
400 unsigned int count, unsigned int offset,
401 int how, struct nfs_commit_info *cinfo)
402{
403 struct nfs_page *req = data->header->req;
404
405 /* Set up the RPC argument and reply structs
406 * NB: take care not to mess about with data->commit et al. */
407
408 data->args.fh = NFS_FH(data->header->inode);
409 data->args.offset = req_offset(req) + offset;
410 /* pnfs_set_layoutcommit needs this */
411 data->mds_offset = data->args.offset;
412 data->args.pgbase = req->wb_pgbase + offset;
413 data->args.pages = data->pages.pagevec;
414 data->args.count = count;
415 data->args.context = get_nfs_open_context(req->wb_context);
416 data->args.lock_context = req->wb_lock_context;
417 data->args.stable = NFS_UNSTABLE;
418 switch (how & (FLUSH_STABLE | FLUSH_COND_STABLE)) {
419 case 0:
420 break;
421 case FLUSH_COND_STABLE:
422 if (nfs_reqs_to_commit(cinfo))
423 break;
424 default:
425 data->args.stable = NFS_FILE_SYNC;
426 }
427
428 data->res.fattr = &data->fattr;
429 data->res.count = count;
430 data->res.eof = 0;
431 data->res.verf = &data->verf;
432 nfs_fattr_init(&data->fattr);
433}
434
435/**
392 * nfs_pgio_prepare - Prepare pageio data to go over the wire 436 * nfs_pgio_prepare - Prepare pageio data to go over the wire
393 * @task: The current task 437 * @task: The current task
394 * @calldata: pageio data to prepare 438 * @calldata: pageio data to prepare