2021-03-23 05:50:52

by Nagendra Tomar

[permalink] [raw]
Subject: [PATCH 3/5] nfs: Add mount option for forcing RPC requests to one file over one connection

From: Nagendra S Tomar <[email protected]>

Rename RPC_TASK_NO_ROUND_ROBIN to RPC_TASK_USE_MAIN_XPRT since
we have more than just the roundrobin policy now.

Signed-off-by: Nagendra S Tomar <[email protected]>
---
fs/nfs/nfs4proc.c | 18 +++++++++---------
include/linux/sunrpc/sched.h | 2 +-
include/trace/events/sunrpc.h | 4 ++--
net/sunrpc/clnt.c | 2 +-
4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c65c4b41e2c1..9516c479ba46 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6274,7 +6274,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
.rpc_message = &msg,
.callback_ops = &nfs4_setclientid_ops,
.callback_data = &setclientid,
- .flags = RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN,
+ .flags = RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT,
};
unsigned long now = jiffies;
int status;
@@ -6341,7 +6341,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp,
clp->cl_rpcclient->cl_auth->au_ops->au_name,
clp->cl_clientid);
status = rpc_call_sync(clp->cl_rpcclient, &msg,
- RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);
+ RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT);
trace_nfs4_setclientid_confirm(clp, status);
dprintk("NFS reply setclientid_confirm: %d\n", status);
return status;
@@ -8078,7 +8078,7 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
.rpc_message = &msg,
.callback_ops = clp->cl_mvops->call_sync_ops,
.callback_data = &data,
- .flags = RPC_TASK_NO_ROUND_ROBIN,
+ .flags = RPC_TASK_USE_MAIN_XPRT,
};
const struct cred *cred = NULL;

@@ -8451,7 +8451,7 @@ nfs4_run_exchange_id(struct nfs_client *clp, const struct cred *cred,
.rpc_client = clp->cl_rpcclient,
.callback_ops = &nfs4_exchange_id_call_ops,
.rpc_message = &msg,
- .flags = RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN,
+ .flags = RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT,
};
struct nfs41_exchange_id_data *calldata;
int status;
@@ -8681,7 +8681,7 @@ static int _nfs4_proc_destroy_clientid(struct nfs_client *clp,
int status;

status = rpc_call_sync(clp->cl_rpcclient, &msg,
- RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);
+ RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT);
trace_nfs4_destroy_clientid(clp, status);
if (status)
dprintk("NFS: Got error %d from the server %s on "
@@ -8959,7 +8959,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp,
args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);

status = rpc_call_sync(session->clp->cl_rpcclient, &msg,
- RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);
+ RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT);
trace_nfs4_create_session(clp, status);

switch (status) {
@@ -9036,7 +9036,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session,
return 0;

status = rpc_call_sync(session->clp->cl_rpcclient, &msg,
- RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);
+ RPC_TASK_TIMEOUT | RPC_TASK_USE_MAIN_XPRT);
trace_nfs4_destroy_session(session->clp, status);

if (status)
@@ -9287,7 +9287,7 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp,
.rpc_client = clp->cl_rpcclient,
.rpc_message = &msg,
.callback_ops = &nfs4_reclaim_complete_call_ops,
- .flags = RPC_TASK_NO_ROUND_ROBIN,
+ .flags = RPC_TASK_USE_MAIN_XPRT,
};
int status = -ENOMEM;

@@ -9808,7 +9808,7 @@ _nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_message = &msg,
.callback_ops = server->nfs_client->cl_mvops->call_sync_ops,
.callback_data = &data,
- .flags = RPC_TASK_NO_ROUND_ROBIN,
+ .flags = RPC_TASK_USE_MAIN_XPRT,
};
const struct cred *cred = NULL;
int status;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index df696efdd675..4885ba352c6b 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -125,7 +125,7 @@ struct rpc_task_setup {
#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */
#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */
#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
-#define RPC_TASK_NO_ROUND_ROBIN 0x0100 /* send requests on "main" xprt */
+#define RPC_TASK_USE_MAIN_XPRT 0x0100 /* send requests on "main" xprt */
#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
#define RPC_TASK_SENT 0x0800 /* message was sent */
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 036eb1f5c133..9c1c0593d0e6 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -301,7 +301,7 @@ TRACE_DEFINE_ENUM(RPC_TASK_NULLCREDS);
TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN);
TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS);
TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC);
-TRACE_DEFINE_ENUM(RPC_TASK_NO_ROUND_ROBIN);
+TRACE_DEFINE_ENUM(RPC_TASK_USE_MAIN_XPRT);
TRACE_DEFINE_ENUM(RPC_TASK_SOFT);
TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN);
TRACE_DEFINE_ENUM(RPC_TASK_SENT);
@@ -318,7 +318,7 @@ TRACE_DEFINE_ENUM(RPC_TASK_CRED_NOREF);
{ RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \
{ RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \
{ RPC_TASK_DYNAMIC, "DYNAMIC" }, \
- { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \
+ { RPC_TASK_USE_MAIN_XPRT, "USE_MAIN_XPRT" }, \
{ RPC_TASK_SOFT, "SOFT" }, \
{ RPC_TASK_SOFTCONN, "SOFTCONN" }, \
{ RPC_TASK_SENT, "SENT" }, \
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index ed470a75e91d..f1fb2984e393 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1066,7 +1066,7 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
{
if (task->tk_xprt)
return;
- if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
+ if (task->tk_flags & RPC_TASK_USE_MAIN_XPRT)
task->tk_xprt = rpc_task_get_first_xprt(clnt);
else {
u32 xprt_hint = 0;