Commit 6de7e12f authored by Anna Schumaker's avatar Anna Schumaker

NFS: Use nfs4_setup_sequence() everywhere

This does the right thing depending on if we have a session, rather than
needing to handle this manually in multiple places.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 42e1cca7
...@@ -305,7 +305,7 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data) ...@@ -305,7 +305,7 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
} }
hdr->pgio_done_cb = filelayout_read_done_cb; hdr->pgio_done_cb = filelayout_read_done_cb;
if (nfs41_setup_sequence(hdr->ds_clp->cl_session, if (nfs4_setup_sequence(hdr->ds_clp,
&hdr->args.seq_args, &hdr->args.seq_args,
&hdr->res.seq_res, &hdr->res.seq_res,
task)) task))
...@@ -403,7 +403,7 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data) ...@@ -403,7 +403,7 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
rpc_exit(task, 0); rpc_exit(task, 0);
return; return;
} }
if (nfs41_setup_sequence(hdr->ds_clp->cl_session, if (nfs4_setup_sequence(hdr->ds_clp,
&hdr->args.seq_args, &hdr->args.seq_args,
&hdr->res.seq_res, &hdr->res.seq_res,
task)) task))
...@@ -438,7 +438,7 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data) ...@@ -438,7 +438,7 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data)
{ {
struct nfs_commit_data *wdata = data; struct nfs_commit_data *wdata = data;
nfs41_setup_sequence(wdata->ds_clp->cl_session, nfs4_setup_sequence(wdata->ds_clp,
&wdata->args.seq_args, &wdata->args.seq_args,
&wdata->res.seq_res, &wdata->res.seq_res,
task); task);
......
...@@ -1384,30 +1384,14 @@ static void ff_layout_read_prepare_v3(struct rpc_task *task, void *data) ...@@ -1384,30 +1384,14 @@ static void ff_layout_read_prepare_v3(struct rpc_task *task, void *data)
rpc_call_start(task); rpc_call_start(task);
} }
static int ff_layout_setup_sequence(struct nfs_client *ds_clp,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
struct rpc_task *task)
{
if (ds_clp->cl_session)
return nfs41_setup_sequence(ds_clp->cl_session,
args,
res,
task);
return nfs40_setup_sequence(ds_clp->cl_slot_tbl,
args,
res,
task);
}
static void ff_layout_read_prepare_v4(struct rpc_task *task, void *data) static void ff_layout_read_prepare_v4(struct rpc_task *task, void *data)
{ {
struct nfs_pgio_header *hdr = data; struct nfs_pgio_header *hdr = data;
if (ff_layout_setup_sequence(hdr->ds_clp, if (nfs4_setup_sequence(hdr->ds_clp,
&hdr->args.seq_args, &hdr->args.seq_args,
&hdr->res.seq_res, &hdr->res.seq_res,
task)) task))
return; return;
if (ff_layout_read_prepare_common(task, hdr)) if (ff_layout_read_prepare_common(task, hdr))
...@@ -1578,10 +1562,10 @@ static void ff_layout_write_prepare_v4(struct rpc_task *task, void *data) ...@@ -1578,10 +1562,10 @@ static void ff_layout_write_prepare_v4(struct rpc_task *task, void *data)
{ {
struct nfs_pgio_header *hdr = data; struct nfs_pgio_header *hdr = data;
if (ff_layout_setup_sequence(hdr->ds_clp, if (nfs4_setup_sequence(hdr->ds_clp,
&hdr->args.seq_args, &hdr->args.seq_args,
&hdr->res.seq_res, &hdr->res.seq_res,
task)) task))
return; return;
if (ff_layout_write_prepare_common(task, hdr)) if (ff_layout_write_prepare_common(task, hdr))
...@@ -1667,10 +1651,10 @@ static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data) ...@@ -1667,10 +1651,10 @@ static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data)
{ {
struct nfs_commit_data *wdata = data; struct nfs_commit_data *wdata = data;
if (ff_layout_setup_sequence(wdata->ds_clp, if (nfs4_setup_sequence(wdata->ds_clp,
&wdata->args.seq_args, &wdata->args.seq_args,
&wdata->res.seq_res, &wdata->res.seq_res,
task)) task))
return; return;
ff_layout_commit_prepare_common(task, data); ff_layout_commit_prepare_common(task, data);
} }
......
...@@ -332,8 +332,8 @@ nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata) ...@@ -332,8 +332,8 @@ nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
} }
nfs4_stateid_copy(&data->args.stateid, &lo->plh_stateid); nfs4_stateid_copy(&data->args.stateid, &lo->plh_stateid);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
nfs41_setup_sequence(nfs4_get_session(server->nfs_client), nfs4_setup_sequence(server->nfs_client, &data->args.seq_args,
&data->args.seq_args, &data->res.seq_res, task); &data->res.seq_res, task);
} }
static void static void
......
...@@ -273,9 +273,6 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, ...@@ -273,9 +273,6 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid,
fmode_t fmode); fmode_t fmode);
#if defined(CONFIG_NFS_V4_1) #if defined(CONFIG_NFS_V4_1)
extern int nfs41_setup_sequence(struct nfs4_session *session,
struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
struct rpc_task *task);
extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *); extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *); extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *);
extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *); extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *);
...@@ -456,7 +453,7 @@ extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); ...@@ -456,7 +453,7 @@ extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid);
extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);
extern void nfs_release_seqid(struct nfs_seqid *seqid); extern void nfs_release_seqid(struct nfs_seqid *seqid);
extern void nfs_free_seqid(struct nfs_seqid *seqid); extern void nfs_free_seqid(struct nfs_seqid *seqid);
extern int nfs40_setup_sequence(struct nfs4_slot_table *tbl, extern int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args, struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res, struct nfs4_sequence_res *res,
struct rpc_task *task); struct rpc_task *task);
......
...@@ -622,10 +622,10 @@ static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args) ...@@ -622,10 +622,10 @@ static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args)
args->sa_privileged = 1; args->sa_privileged = 1;
} }
int nfs40_setup_sequence(struct nfs4_slot_table *tbl, static int nfs40_setup_sequence(struct nfs4_slot_table *tbl,
struct nfs4_sequence_args *args, struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res, struct nfs4_sequence_res *res,
struct rpc_task *task) struct rpc_task *task)
{ {
struct nfs4_slot *slot; struct nfs4_slot *slot;
...@@ -662,7 +662,6 @@ int nfs40_setup_sequence(struct nfs4_slot_table *tbl, ...@@ -662,7 +662,6 @@ int nfs40_setup_sequence(struct nfs4_slot_table *tbl,
spin_unlock(&tbl->slot_tbl_lock); spin_unlock(&tbl->slot_tbl_lock);
return -EAGAIN; return -EAGAIN;
} }
EXPORT_SYMBOL_GPL(nfs40_setup_sequence);
static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res) static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res)
{ {
...@@ -882,7 +881,7 @@ int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) ...@@ -882,7 +881,7 @@ int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
} }
EXPORT_SYMBOL_GPL(nfs4_sequence_done); EXPORT_SYMBOL_GPL(nfs4_sequence_done);
int nfs41_setup_sequence(struct nfs4_session *session, static int nfs41_setup_sequence(struct nfs4_session *session,
struct nfs4_sequence_args *args, struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res, struct nfs4_sequence_res *res,
struct rpc_task *task) struct rpc_task *task)
...@@ -945,12 +944,11 @@ int nfs41_setup_sequence(struct nfs4_session *session, ...@@ -945,12 +944,11 @@ int nfs41_setup_sequence(struct nfs4_session *session,
spin_unlock(&tbl->slot_tbl_lock); spin_unlock(&tbl->slot_tbl_lock);
return -EAGAIN; return -EAGAIN;
} }
EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
static int nfs4_setup_sequence(const struct nfs_client *client, int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args, struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res, struct nfs4_sequence_res *res,
struct rpc_task *task) struct rpc_task *task)
{ {
struct nfs4_session *session = nfs4_get_session(client); struct nfs4_session *session = nfs4_get_session(client);
int ret = 0; int ret = 0;
...@@ -968,6 +966,7 @@ static int nfs4_setup_sequence(const struct nfs_client *client, ...@@ -968,6 +966,7 @@ static int nfs4_setup_sequence(const struct nfs_client *client,
dprintk("<-- %s status=%d\n", __func__, ret); dprintk("<-- %s status=%d\n", __func__, ret);
return 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)
{ {
...@@ -993,13 +992,14 @@ static const struct rpc_call_ops nfs41_call_sync_ops = { ...@@ -993,13 +992,14 @@ static const struct rpc_call_ops nfs41_call_sync_ops = {
#else /* !CONFIG_NFS_V4_1 */ #else /* !CONFIG_NFS_V4_1 */
static int nfs4_setup_sequence(const struct nfs_client *client, int nfs4_setup_sequence(const struct nfs_client *client,
struct nfs4_sequence_args *args, struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res, struct nfs4_sequence_res *res,
struct rpc_task *task) struct rpc_task *task)
{ {
return nfs40_setup_sequence(client->cl_slot_tbl, args, res, 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)
{ {
......
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