diff options
author | Fred Isaman <iisaman@netapp.com> | 2012-04-20 14:47:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-27 14:10:37 -0400 |
commit | cd841605f7a721878d8a2d1362484723d8abf569 (patch) | |
tree | b5c37db575cd545a183577249909e042fe38d646 /fs/nfs/proc.c | |
parent | b5542849764aa56fd3f05c0041195b637b9d2ac2 (diff) |
NFS: create common nfs_pgio_header for both read and write
In order to avoid duplicating all the data in nfs_read_data whenever we
split it up into multiple RPC calls (either due to a short read result
or due to rsize < PAGE_SIZE), we split out the bits that are the same
per RPC call into a separate "header" structure.
The goal this patch moves towards is to have a single header
refcounted by several rpc_data structures. Thus, want to always refer
from rpc_data to the header, and not the other way. This patch comes
close to that ideal, but the directio code currently needs some
special casing, isolated in the nfs_direct_[read_write]hdr_release()
functions. This will be dealt with in a future patch.
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r-- | fs/nfs/proc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index bf80503200f5..22ee70586875 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -641,12 +641,14 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
641 | 641 | ||
642 | static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data) | 642 | static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data) |
643 | { | 643 | { |
644 | struct inode *inode = data->header->inode; | ||
645 | |||
644 | if (nfs_async_handle_expired_key(task)) | 646 | if (nfs_async_handle_expired_key(task)) |
645 | return -EAGAIN; | 647 | return -EAGAIN; |
646 | 648 | ||
647 | nfs_invalidate_atime(data->inode); | 649 | nfs_invalidate_atime(inode); |
648 | if (task->tk_status >= 0) { | 650 | if (task->tk_status >= 0) { |
649 | nfs_refresh_inode(data->inode, data->res.fattr); | 651 | nfs_refresh_inode(inode, data->res.fattr); |
650 | /* Emulate the eof flag, which isn't normally needed in NFSv2 | 652 | /* Emulate the eof flag, which isn't normally needed in NFSv2 |
651 | * as it is guaranteed to always return the file attributes | 653 | * as it is guaranteed to always return the file attributes |
652 | */ | 654 | */ |
@@ -668,11 +670,13 @@ static void nfs_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_dat | |||
668 | 670 | ||
669 | static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data) | 671 | static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data) |
670 | { | 672 | { |
673 | struct inode *inode = data->header->inode; | ||
674 | |||
671 | if (nfs_async_handle_expired_key(task)) | 675 | if (nfs_async_handle_expired_key(task)) |
672 | return -EAGAIN; | 676 | return -EAGAIN; |
673 | 677 | ||
674 | if (task->tk_status >= 0) | 678 | if (task->tk_status >= 0) |
675 | nfs_post_op_update_inode_force_wcc(data->inode, data->res.fattr); | 679 | nfs_post_op_update_inode_force_wcc(inode, data->res.fattr); |
676 | return 0; | 680 | return 0; |
677 | } | 681 | } |
678 | 682 | ||