Skip to content

Commit 2057a48

Browse files
josefbacikTrond Myklebust
authored andcommitted
sunrpc: add a struct rpc_stats arg to rpc_create_args
We want to be able to have our rpc stats handled in a per network namespace manner, so add an option to rpc_create_args to specify a different rpc_stats struct instead of using the one on the rpc_program. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent edc99a2 commit 2057a48

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/linux/sunrpc/clnt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ struct rpc_create_args {
139139
const char *servername;
140140
const char *nodename;
141141
const struct rpc_program *program;
142+
struct rpc_stat *stats;
142143
u32 prognumber; /* overrides program->number */
143144
u32 version;
144145
rpc_authflavor_t authflavor;

net/sunrpc/clnt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
405405
clnt->cl_maxproc = version->nrprocs;
406406
clnt->cl_prog = args->prognumber ? : program->number;
407407
clnt->cl_vers = version->number;
408-
clnt->cl_stats = program->stats;
408+
clnt->cl_stats = args->stats ? : program->stats;
409409
clnt->cl_metrics = rpc_alloc_iostats(clnt);
410410
rpc_init_pipe_dir_head(&clnt->cl_pipedir_objects);
411411
err = -ENOMEM;
@@ -691,6 +691,7 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *clnt)
691691
.version = clnt->cl_vers,
692692
.authflavor = clnt->cl_auth->au_flavor,
693693
.cred = clnt->cl_cred,
694+
.stats = clnt->cl_stats,
694695
};
695696
return __rpc_clone_client(&args, clnt);
696697
}
@@ -713,6 +714,7 @@ rpc_clone_client_set_auth(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
713714
.version = clnt->cl_vers,
714715
.authflavor = flavor,
715716
.cred = clnt->cl_cred,
717+
.stats = clnt->cl_stats,
716718
};
717719
return __rpc_clone_client(&args, clnt);
718720
}
@@ -1068,6 +1070,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
10681070
.version = vers,
10691071
.authflavor = old->cl_auth->au_flavor,
10701072
.cred = old->cl_cred,
1073+
.stats = old->cl_stats,
10711074
};
10721075
struct rpc_clnt *clnt;
10731076
int err;

0 commit comments

Comments
 (0)