Commit 7981c8a6 authored by Anna Schumaker's avatar Anna Schumaker

NFS: Create a single nfs4_setup_sequence() function

The inline ifdef lets us put everything in a single place, rather than
having two (very similar) versions of this function.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 6de7e12f
...@@ -945,37 +945,14 @@ static int nfs41_setup_sequence(struct nfs4_session *session, ...@@ -945,37 +945,14 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
return -EAGAIN; return -EAGAIN;
} }
int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
struct rpc_task *task)
{
struct nfs4_session *session = nfs4_get_session(client);
int ret = 0;
if (!session)
return nfs40_setup_sequence(client->cl_slot_tbl,
args, res, task);
dprintk("--> %s clp %p session %p sr_slot %u\n",
__func__, session->clp, session, res->sr_slot ?
res->sr_slot->slot_nr : NFS4_NO_SLOT);
ret = nfs41_setup_sequence(session, args, res, task);
dprintk("<-- %s status=%d\n", __func__, ret);
return ret;
}
EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs4_call_sync_data *data = calldata; struct nfs4_call_sync_data *data = calldata;
struct nfs4_session *session = nfs4_get_session(data->seq_server->nfs_client);
dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server); dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
nfs41_setup_sequence(session, data->seq_args, data->seq_res, task); nfs4_setup_sequence(data->seq_server->nfs_client,
data->seq_args, data->seq_res, task);
} }
static void nfs41_call_sync_done(struct rpc_task *task, void *calldata) static void nfs41_call_sync_done(struct rpc_task *task, void *calldata)
...@@ -992,15 +969,6 @@ static const struct rpc_call_ops nfs41_call_sync_ops = { ...@@ -992,15 +969,6 @@ static const struct rpc_call_ops nfs41_call_sync_ops = {
#else /* !CONFIG_NFS_V4_1 */ #else /* !CONFIG_NFS_V4_1 */
int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
struct rpc_task *task)
{
return nfs40_setup_sequence(client->cl_slot_tbl, args, res, task);
}
EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res) static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res)
{ {
return nfs40_sequence_done(task, res); return nfs40_sequence_done(task, res);
...@@ -1021,6 +989,22 @@ EXPORT_SYMBOL_GPL(nfs4_sequence_done); ...@@ -1021,6 +989,22 @@ EXPORT_SYMBOL_GPL(nfs4_sequence_done);
#endif /* !CONFIG_NFS_V4_1 */ #endif /* !CONFIG_NFS_V4_1 */
int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
struct rpc_task *task)
{
#if defined(CONFIG_NFS_V4_1)
struct nfs4_session *session = nfs4_get_session(client);
if (session)
return nfs41_setup_sequence(session, args, res, task);
#endif /* CONFIG_NFS_V4_1 */
return nfs40_setup_sequence(client->cl_slot_tbl, args, res, task);
}
EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata) static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs4_call_sync_data *data = calldata; struct nfs4_call_sync_data *data = calldata;
...@@ -2047,8 +2031,8 @@ static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata) ...@@ -2047,8 +2031,8 @@ static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs4_opendata *data = calldata; struct nfs4_opendata *data = calldata;
nfs40_setup_sequence(data->o_arg.server->nfs_client->cl_slot_tbl, nfs4_setup_sequence(data->o_arg.server->nfs_client,
&data->c_arg.seq_args, &data->c_res.seq_res, task); &data->c_arg.seq_args, &data->c_res.seq_res, task);
} }
static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
...@@ -6639,8 +6623,8 @@ static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata ...@@ -6639,8 +6623,8 @@ static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata
{ {
struct nfs_release_lockowner_data *data = calldata; struct nfs_release_lockowner_data *data = calldata;
struct nfs_server *server = data->server; struct nfs_server *server = data->server;
nfs40_setup_sequence(server->nfs_client->cl_slot_tbl, nfs4_setup_sequence(server->nfs_client, &data->args.seq_args,
&data->args.seq_args, &data->res.seq_res, task); &data->res.seq_res, task);
data->args.lock_owner.clientid = server->nfs_client->cl_clientid; data->args.lock_owner.clientid = server->nfs_client->cl_clientid;
data->timestamp = jiffies; data->timestamp = jiffies;
} }
...@@ -7830,7 +7814,7 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task, ...@@ -7830,7 +7814,7 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task,
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
/* just setup sequence, do not trigger session recovery /* just setup sequence, do not trigger session recovery
since we're invoked within one */ since we're invoked within one */
nfs41_setup_sequence(data->clp->cl_session, nfs4_setup_sequence(data->clp,
&data->args->la_seq_args, &data->args->la_seq_args,
&data->res->lr_seq_res, &data->res->lr_seq_res,
task); task);
...@@ -8201,7 +8185,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data) ...@@ -8201,7 +8185,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
args = task->tk_msg.rpc_argp; args = task->tk_msg.rpc_argp;
res = task->tk_msg.rpc_resp; res = task->tk_msg.rpc_resp;
nfs41_setup_sequence(clp->cl_session, args, res, task); nfs4_setup_sequence(clp, args, res, task);
} }
static const struct rpc_call_ops nfs41_sequence_ops = { static const struct rpc_call_ops nfs41_sequence_ops = {
...@@ -8289,7 +8273,7 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data) ...@@ -8289,7 +8273,7 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
{ {
struct nfs4_reclaim_complete_data *calldata = data; struct nfs4_reclaim_complete_data *calldata = data;
nfs41_setup_sequence(calldata->clp->cl_session, nfs4_setup_sequence(calldata->clp,
&calldata->arg.seq_args, &calldata->arg.seq_args,
&calldata->res.seq_res, &calldata->res.seq_res,
task); task);
...@@ -8396,10 +8380,9 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata) ...@@ -8396,10 +8380,9 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs4_layoutget *lgp = calldata; struct nfs4_layoutget *lgp = calldata;
struct nfs_server *server = NFS_SERVER(lgp->args.inode); struct nfs_server *server = NFS_SERVER(lgp->args.inode);
struct nfs4_session *session = nfs4_get_session(server->nfs_client);
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
nfs41_setup_sequence(session, &lgp->args.seq_args, nfs4_setup_sequence(server->nfs_client, &lgp->args.seq_args,
&lgp->res.seq_res, task); &lgp->res.seq_res, task);
dprintk("<-- %s\n", __func__); dprintk("<-- %s\n", __func__);
} }
...@@ -8643,7 +8626,7 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata) ...@@ -8643,7 +8626,7 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
struct nfs4_layoutreturn *lrp = calldata; struct nfs4_layoutreturn *lrp = calldata;
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
nfs41_setup_sequence(lrp->clp->cl_session, nfs4_setup_sequence(lrp->clp,
&lrp->args.seq_args, &lrp->args.seq_args,
&lrp->res.seq_res, &lrp->res.seq_res,
task); task);
...@@ -8793,9 +8776,8 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata) ...@@ -8793,9 +8776,8 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs4_layoutcommit_data *data = calldata; struct nfs4_layoutcommit_data *data = calldata;
struct nfs_server *server = NFS_SERVER(data->args.inode); struct nfs_server *server = NFS_SERVER(data->args.inode);
struct nfs4_session *session = nfs4_get_session(server->nfs_client);
nfs41_setup_sequence(session, nfs4_setup_sequence(server->nfs_client,
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task); task);
...@@ -9119,7 +9101,7 @@ struct nfs_free_stateid_data { ...@@ -9119,7 +9101,7 @@ struct nfs_free_stateid_data {
static void nfs41_free_stateid_prepare(struct rpc_task *task, void *calldata) static void nfs41_free_stateid_prepare(struct rpc_task *task, void *calldata)
{ {
struct nfs_free_stateid_data *data = calldata; struct nfs_free_stateid_data *data = calldata;
nfs41_setup_sequence(nfs4_get_session(data->server->nfs_client), nfs4_setup_sequence(data->server->nfs_client,
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task); task);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment