aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-16 09:52:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-22 13:24:01 -0400
commit71ac6da9944e2c9ec73ca64ca7bca74428858585 (patch)
tree3ca5c332b228126a88ad03d82e59f14c68dc58ee /fs/nfs/nfs4proc.c
parentaa5190d0ed7d042c6d7d89fe8101558a912eee73 (diff)
NFSv4.1: Merge the nfs41_proc_async_sequence() and nfs4_proc_sequence()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c68
1 files changed, 44 insertions, 24 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a00932c1215e..75847e4898a0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5048,24 +5048,6 @@ int nfs4_init_session(struct nfs_server *server)
5048/* 5048/*
5049 * Renew the cl_session lease. 5049 * Renew the cl_session lease.
5050 */ 5050 */
5051static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
5052{
5053 struct nfs4_sequence_args args;
5054 struct nfs4_sequence_res res;
5055
5056 struct rpc_message msg = {
5057 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE],
5058 .rpc_argp = &args,
5059 .rpc_resp = &res,
5060 .rpc_cred = cred,
5061 };
5062
5063 args.sa_cache_this = 0;
5064
5065 return nfs4_call_sync_sequence(clp, clp->cl_rpcclient, &msg, &args,
5066 &res, args.sa_cache_this, 1);
5067}
5068
5069struct nfs4_sequence_data { 5051struct nfs4_sequence_data {
5070 struct nfs_client *clp; 5052 struct nfs_client *clp;
5071 struct nfs4_sequence_args args; 5053 struct nfs4_sequence_args args;
@@ -5139,29 +5121,67 @@ static const struct rpc_call_ops nfs41_sequence_ops = {
5139 .rpc_release = nfs41_sequence_release, 5121 .rpc_release = nfs41_sequence_release,
5140}; 5122};
5141 5123
5142static int nfs41_proc_async_sequence(struct nfs_client *clp, 5124static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
5143 struct rpc_cred *cred)
5144{ 5125{
5145 struct nfs4_sequence_data *calldata; 5126 struct nfs4_sequence_data *calldata;
5146 struct rpc_message msg = { 5127 struct rpc_message msg = {
5147 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE], 5128 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE],
5148 .rpc_cred = cred, 5129 .rpc_cred = cred,
5149 }; 5130 };
5131 struct rpc_task_setup task_setup_data = {
5132 .rpc_client = clp->cl_rpcclient,
5133 .rpc_message = &msg,
5134 .callback_ops = &nfs41_sequence_ops,
5135 .flags = RPC_TASK_ASYNC | RPC_TASK_SOFT,
5136 };
5150 5137
5151 if (!atomic_inc_not_zero(&clp->cl_count)) 5138 if (!atomic_inc_not_zero(&clp->cl_count))
5152 return -EIO; 5139 return ERR_PTR(-EIO);
5153 calldata = kmalloc(sizeof(*calldata), GFP_NOFS); 5140 calldata = kmalloc(sizeof(*calldata), GFP_NOFS);
5154 if (calldata == NULL) { 5141 if (calldata == NULL) {
5155 nfs_put_client(clp); 5142 nfs_put_client(clp);
5156 return -ENOMEM; 5143 return ERR_PTR(-ENOMEM);
5157 } 5144 }
5158 calldata->res.sr_slotid = NFS4_MAX_SLOT_TABLE; 5145 calldata->res.sr_slotid = NFS4_MAX_SLOT_TABLE;
5159 msg.rpc_argp = &calldata->args; 5146 msg.rpc_argp = &calldata->args;
5160 msg.rpc_resp = &calldata->res; 5147 msg.rpc_resp = &calldata->res;
5161 calldata->clp = clp; 5148 calldata->clp = clp;
5149 task_setup_data.callback_data = calldata;
5162 5150
5163 return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, 5151 return rpc_run_task(&task_setup_data);
5164 &nfs41_sequence_ops, calldata); 5152}
5153
5154static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred)
5155{
5156 struct rpc_task *task;
5157 int ret = 0;
5158
5159 task = _nfs41_proc_sequence(clp, cred);
5160 if (IS_ERR(task))
5161 ret = PTR_ERR(task);
5162 else
5163 rpc_put_task(task);
5164 dprintk("<-- %s status=%d\n", __func__, ret);
5165 return ret;
5166}
5167
5168static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
5169{
5170 struct rpc_task *task;
5171 int ret;
5172
5173 task = _nfs41_proc_sequence(clp, cred);
5174 if (IS_ERR(task)) {
5175 ret = PTR_ERR(task);
5176 goto out;
5177 }
5178 ret = rpc_wait_for_completion_task(task);
5179 if (!ret)
5180 ret = task->tk_status;
5181 rpc_put_task(task);
5182out:
5183 dprintk("<-- %s status=%d\n", __func__, ret);
5184 return ret;
5165} 5185}
5166 5186
5167struct nfs4_reclaim_complete_data { 5187struct nfs4_reclaim_complete_data {