diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-11-15 21:47:27 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-12-01 17:21:47 -0500 |
commit | 828ed9ec1b565445b8c060c8a97be4f396ef614b (patch) | |
tree | 7f7511fc3f0268fffd14f3c777690487d2170477 /fs/nfs/pnfs.c | |
parent | 586f1c39daf5c840c742b9be1ec236429f26dc13 (diff) |
pNFS: Clean up - add a helper to initialise struct layoutreturn_args
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index d7b5ad437b14..a93afdd37203 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1014,6 +1014,23 @@ pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, | |||
1014 | return true; | 1014 | return true; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | static void | ||
1018 | pnfs_init_layoutreturn_args(struct nfs4_layoutreturn_args *args, | ||
1019 | struct pnfs_layout_hdr *lo, | ||
1020 | const nfs4_stateid *stateid, | ||
1021 | enum pnfs_iomode iomode) | ||
1022 | { | ||
1023 | struct inode *inode = lo->plh_inode; | ||
1024 | |||
1025 | args->layout_type = NFS_SERVER(inode)->pnfs_curr_ld->id; | ||
1026 | args->inode = inode; | ||
1027 | args->range.iomode = iomode; | ||
1028 | args->range.offset = 0; | ||
1029 | args->range.length = NFS4_MAX_UINT64; | ||
1030 | args->layout = lo; | ||
1031 | nfs4_stateid_copy(&args->stateid, stateid); | ||
1032 | } | ||
1033 | |||
1017 | static int | 1034 | static int |
1018 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, const nfs4_stateid *stateid, | 1035 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, const nfs4_stateid *stateid, |
1019 | enum pnfs_iomode iomode, bool sync) | 1036 | enum pnfs_iomode iomode, bool sync) |
@@ -1032,13 +1049,7 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, const nfs4_stateid *stateid, | |||
1032 | goto out; | 1049 | goto out; |
1033 | } | 1050 | } |
1034 | 1051 | ||
1035 | nfs4_stateid_copy(&lrp->args.stateid, stateid); | 1052 | pnfs_init_layoutreturn_args(&lrp->args, lo, stateid, iomode); |
1036 | lrp->args.layout_type = NFS_SERVER(ino)->pnfs_curr_ld->id; | ||
1037 | lrp->args.inode = ino; | ||
1038 | lrp->args.range.iomode = iomode; | ||
1039 | lrp->args.range.offset = 0; | ||
1040 | lrp->args.range.length = NFS4_MAX_UINT64; | ||
1041 | lrp->args.layout = lo; | ||
1042 | lrp->clp = NFS_SERVER(ino)->nfs_client; | 1053 | lrp->clp = NFS_SERVER(ino)->nfs_client; |
1043 | lrp->cred = lo->plh_lc_cred; | 1054 | lrp->cred = lo->plh_lc_cred; |
1044 | 1055 | ||