提交 d9afbd1b 编写于 作者: T Trond Myklebust

NFSv4.1: Simplify the sequence setup

Nobody calls nfs4_setup_sequence or nfs41_setup_sequence without
also calling rpc_call_start() on success. This commit therefore
folds the rpc_call_start call into nfs41_setup_sequence().
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 6ba7db34
......@@ -273,6 +273,7 @@ static inline int nfs4_setup_sequence(const struct nfs_server *server,
struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
struct rpc_task *task)
{
rpc_call_start(task);
return 0;
}
......
......@@ -307,12 +307,10 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
}
rdata->read_done_cb = filelayout_read_done_cb;
if (nfs41_setup_sequence(rdata->ds_clp->cl_session,
&rdata->args.seq_args, &rdata->res.seq_res,
task))
return;
rpc_call_start(task);
nfs41_setup_sequence(rdata->ds_clp->cl_session,
&rdata->args.seq_args,
&rdata->res.seq_res,
task);
}
static void filelayout_read_call_done(struct rpc_task *task, void *data)
......@@ -409,12 +407,10 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
rpc_exit(task, 0);
return;
}
if (nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args, &wdata->res.seq_res,
task))
return;
rpc_call_start(task);
nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args,
&wdata->res.seq_res,
task);
}
static void filelayout_write_call_done(struct rpc_task *task, void *data)
......@@ -450,12 +446,10 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data)
{
struct nfs_commit_data *wdata = data;
if (nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args, &wdata->res.seq_res,
task))
return;
rpc_call_start(task);
nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args,
&wdata->res.seq_res,
task);
}
static void filelayout_write_commit_done(struct rpc_task *task, void *data)
......
......@@ -513,7 +513,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
dprintk("--> %s\n", __func__);
/* slot already allocated? */
if (res->sr_slot != NULL)
return 0;
goto out_success;
tbl = &session->fc_slot_table;
......@@ -563,6 +563,8 @@ int nfs41_setup_sequence(struct nfs4_session *session,
* set to 1 if an rpc level failure occurs.
*/
res->sr_status = 1;
out_success:
rpc_call_start(task);
return 0;
}
EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
......@@ -575,8 +577,10 @@ int nfs4_setup_sequence(const struct nfs_server *server,
struct nfs4_session *session = nfs4_get_session(server);
int ret = 0;
if (session == NULL)
if (session == NULL) {
rpc_call_start(task);
goto out;
}
dprintk("--> %s clp %p session %p sr_slot %d\n",
__func__, session->clp, session, res->sr_slot ?
......@@ -601,10 +605,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
if (nfs41_setup_sequence(session, data->seq_args,
data->seq_res, task))
return;
rpc_call_start(task);
nfs41_setup_sequence(session, data->seq_args, data->seq_res, task);
}
static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata)
......@@ -1485,8 +1486,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
&data->o_res.seq_res,
task) != 0)
nfs_release_seqid(data->o_arg.seqid);
else
rpc_call_start(task);
return;
unlock_no_action:
rcu_read_unlock();
......@@ -2192,8 +2191,6 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
&calldata->res.seq_res,
task) != 0)
nfs_release_seqid(calldata->arg.seqid);
else
rpc_call_start(task);
out:
dprintk("%s: done!\n", __func__);
}
......@@ -2932,12 +2929,10 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->dir),
nfs4_setup_sequence(NFS_SERVER(data->dir),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
task);
}
static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
......@@ -2965,12 +2960,10 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->old_dir),
nfs4_setup_sequence(NFS_SERVER(data->old_dir),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
task);
}
static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
......@@ -3459,12 +3452,10 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
static void nfs4_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_data *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->header->inode),
nfs4_setup_sequence(NFS_SERVER(data->header->inode),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
task);
}
static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data)
......@@ -3525,22 +3516,18 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->header->inode),
nfs4_setup_sequence(NFS_SERVER(data->header->inode),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
task);
}
static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->inode),
nfs4_setup_sequence(NFS_SERVER(data->inode),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
task);
}
static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *data)
......@@ -4187,11 +4174,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
d_data = (struct nfs4_delegreturndata *)data;
if (nfs4_setup_sequence(d_data->res.server,
nfs4_setup_sequence(d_data->res.server,
&d_data->args.seq_args,
&d_data->res.seq_res, task))
return;
rpc_call_start(task);
&d_data->res.seq_res,
task);
}
#endif /* CONFIG_NFS_V4_1 */
......@@ -4445,8 +4431,6 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
&calldata->res.seq_res,
task) != 0)
nfs_release_seqid(calldata->arg.seqid);
else
rpc_call_start(task);
}
static const struct rpc_call_ops nfs4_locku_ops = {
......@@ -4601,10 +4585,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
if (nfs4_setup_sequence(data->server,
&data->arg.seq_args,
&data->res.seq_res,
task) == 0) {
rpc_call_start(task);
task) == 0)
return;
}
nfs_release_seqid(data->arg.open_seqid);
out_release_lock_seqid:
nfs_release_seqid(data->arg.lock_seqid);
......@@ -5462,7 +5444,6 @@ struct nfs4_get_lease_time_data {
static void nfs4_get_lease_time_prepare(struct rpc_task *task,
void *calldata)
{
int ret;
struct nfs4_get_lease_time_data *data =
(struct nfs4_get_lease_time_data *)calldata;
......@@ -5470,12 +5451,10 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task,
rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
/* just setup sequence, do not trigger session recovery
since we're invoked within one */
ret = nfs41_setup_sequence(data->clp->cl_session,
nfs41_setup_sequence(data->clp->cl_session,
&data->args->la_seq_args,
&data->res->lr_seq_res, task);
if (ret != -EAGAIN)
rpc_call_start(task);
&data->res->lr_seq_res,
task);
dprintk("<-- %s\n", __func__);
}
......@@ -5809,9 +5788,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
args = task->tk_msg.rpc_argp;
res = task->tk_msg.rpc_resp;
if (nfs41_setup_sequence(clp->cl_session, args, res, task))
return;
rpc_call_start(task);
nfs41_setup_sequence(clp->cl_session, args, res, task);
}
static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data)
......@@ -5914,12 +5891,10 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
struct nfs4_reclaim_complete_data *calldata = data;
rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
if (nfs41_setup_sequence(calldata->clp->cl_session,
nfs41_setup_sequence(calldata->clp->cl_session,
&calldata->arg.seq_args,
&calldata->res.seq_res, task))
return;
rpc_call_start(task);
&calldata->res.seq_res,
task);
}
static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nfs_client *clp)
......@@ -6034,9 +6009,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
NFS_I(lgp->args.inode)->layout,
lgp->args.ctx->state)) {
rpc_exit(task, NFS4_OK);
return;
}
rpc_call_start(task);
}
static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
......@@ -6200,10 +6173,10 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
struct nfs4_layoutreturn *lrp = calldata;
dprintk("--> %s\n", __func__);
if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args,
&lrp->res.seq_res, task))
return;
rpc_call_start(task);
nfs41_setup_sequence(lrp->clp->cl_session,
&lrp->args.seq_args,
&lrp->res.seq_res,
task);
}
static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
......@@ -6364,10 +6337,10 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata)
struct nfs_server *server = NFS_SERVER(data->args.inode);
struct nfs4_session *session = nfs4_get_session(server);
if (nfs41_setup_sequence(session, &data->args.seq_args,
&data->res.seq_res, task))
return;
rpc_call_start(task);
nfs41_setup_sequence(session,
&data->args.seq_args,
&data->res.seq_res,
task);
}
static void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册