diff options
author | Anna Schumaker <Anna.Schumaker@netapp.com> | 2014-05-06 09:12:32 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-28 18:40:36 -0400 |
commit | 0eecb2145c1ce18e36617008424a93836ad0a3bd (patch) | |
tree | 469884c95d6e3c65383800e0c41b197d44851543 /fs/nfs/read.c | |
parent | a4cdda59111f92000297e0d3edb1e0e08ba3549b (diff) |
NFS: Create a common nfs_pgio_result_common function
Combining these functions will let me make a single nfs_rw_common_ops
struct (see the next patch).
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r-- | fs/nfs/read.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index cfa15e828dd6..bc78bd248eb8 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -388,15 +388,10 @@ static const struct nfs_pageio_ops nfs_pageio_read_ops = { | |||
388 | * This is the callback from RPC telling us whether a reply was | 388 | * This is the callback from RPC telling us whether a reply was |
389 | * received or some error occurred (timeout or socket shutdown). | 389 | * received or some error occurred (timeout or socket shutdown). |
390 | */ | 390 | */ |
391 | int nfs_readpage_result(struct rpc_task *task, struct nfs_pgio_data *data) | 391 | static int nfs_readpage_done(struct rpc_task *task, struct nfs_pgio_data *data, |
392 | struct inode *inode) | ||
392 | { | 393 | { |
393 | struct inode *inode = data->header->inode; | 394 | int status = NFS_PROTO(inode)->read_done(task, data); |
394 | int status; | ||
395 | |||
396 | dprintk("NFS: %s: %5u, (status %d)\n", __func__, task->tk_pid, | ||
397 | task->tk_status); | ||
398 | |||
399 | status = NFS_PROTO(inode)->read_done(task, data); | ||
400 | if (status != 0) | 395 | if (status != 0) |
401 | return status; | 396 | return status; |
402 | 397 | ||
@@ -429,17 +424,11 @@ static void nfs_readpage_retry(struct rpc_task *task, struct nfs_pgio_data *data | |||
429 | rpc_restart_call_prepare(task); | 424 | rpc_restart_call_prepare(task); |
430 | } | 425 | } |
431 | 426 | ||
432 | static void nfs_readpage_result_common(struct rpc_task *task, void *calldata) | 427 | static void nfs_readpage_result(struct rpc_task *task, struct nfs_pgio_data *data) |
433 | { | 428 | { |
434 | struct nfs_pgio_data *data = calldata; | ||
435 | struct nfs_pgio_header *hdr = data->header; | 429 | struct nfs_pgio_header *hdr = data->header; |
436 | 430 | ||
437 | /* Note the only returns of nfs_readpage_result are 0 and -EAGAIN */ | 431 | if (data->res.eof) { |
438 | if (nfs_readpage_result(task, data) != 0) | ||
439 | return; | ||
440 | if (task->tk_status < 0) | ||
441 | nfs_set_pgio_error(hdr, task->tk_status, data->args.offset); | ||
442 | else if (data->res.eof) { | ||
443 | loff_t bound; | 432 | loff_t bound; |
444 | 433 | ||
445 | bound = data->args.offset + data->res.count; | 434 | bound = data->args.offset + data->res.count; |
@@ -456,7 +445,7 @@ static void nfs_readpage_result_common(struct rpc_task *task, void *calldata) | |||
456 | 445 | ||
457 | static const struct rpc_call_ops nfs_read_common_ops = { | 446 | static const struct rpc_call_ops nfs_read_common_ops = { |
458 | .rpc_call_prepare = nfs_pgio_prepare, | 447 | .rpc_call_prepare = nfs_pgio_prepare, |
459 | .rpc_call_done = nfs_readpage_result_common, | 448 | .rpc_call_done = nfs_pgio_result, |
460 | .rpc_release = nfs_pgio_release, | 449 | .rpc_release = nfs_pgio_release, |
461 | }; | 450 | }; |
462 | 451 | ||
@@ -625,4 +614,6 @@ static const struct nfs_rw_ops nfs_rw_read_ops = { | |||
625 | .rw_mode = FMODE_READ, | 614 | .rw_mode = FMODE_READ, |
626 | .rw_alloc_header = nfs_readhdr_alloc, | 615 | .rw_alloc_header = nfs_readhdr_alloc, |
627 | .rw_free_header = nfs_readhdr_free, | 616 | .rw_free_header = nfs_readhdr_free, |
617 | .rw_done = nfs_readpage_done, | ||
618 | .rw_result = nfs_readpage_result, | ||
628 | }; | 619 | }; |