Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfs: make the rpc_stat per net namespace

Now that we're exposing the rpc stats on a per-network namespace basis,
move this struct into struct nfs_net and use that to make sure only the
per-network namespace stats are exposed.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Josef Bacik and committed by
Trond Myklebust
1548036e d47151b7

+9 -4
+4 -1
fs/nfs/client.c
··· 73 73 .number = NFS_PROGRAM, 74 74 .nrvers = ARRAY_SIZE(nfs_version), 75 75 .version = nfs_version, 76 - .stats = &nfs_rpcstat, 77 76 .pipe_dir_name = NFS_PIPE_DIRNAME, 78 77 }; 79 78 ··· 501 502 const struct nfs_client_initdata *cl_init, 502 503 rpc_authflavor_t flavor) 503 504 { 505 + struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); 504 506 struct rpc_clnt *clnt = NULL; 505 507 struct rpc_create_args args = { 506 508 .net = clp->cl_net, ··· 513 513 .servername = clp->cl_hostname, 514 514 .nodename = cl_init->nodename, 515 515 .program = &nfs_program, 516 + .stats = &nn->rpcstats, 516 517 .version = clp->rpc_ops->version, 517 518 .authflavor = flavor, 518 519 .cred = cl_init->cred, ··· 1183 1182 #endif 1184 1183 spin_lock_init(&nn->nfs_client_lock); 1185 1184 nn->boot_time = ktime_get_real(); 1185 + memset(&nn->rpcstats, 0, sizeof(nn->rpcstats)); 1186 + nn->rpcstats.program = &nfs_program; 1186 1187 1187 1188 nfs_netns_sysfs_setup(nn, net); 1188 1189 }
+3 -1
fs/nfs/inode.c
··· 2426 2426 2427 2427 static int nfs_net_init(struct net *net) 2428 2428 { 2429 + struct nfs_net *nn = net_generic(net, nfs_net_id); 2430 + 2429 2431 nfs_clients_init(net); 2430 - rpc_proc_register(net, &nfs_rpcstat); 2432 + rpc_proc_register(net, &nn->rpcstats); 2431 2433 return nfs_fs_proc_net_init(net); 2432 2434 } 2433 2435
-2
fs/nfs/internal.h
··· 449 449 int nfs_get_tree_common(struct fs_context *); 450 450 void nfs_kill_super(struct super_block *); 451 451 452 - extern struct rpc_stat nfs_rpcstat; 453 - 454 452 extern int __init register_nfs_fs(void); 455 453 extern void __exit unregister_nfs_fs(void); 456 454 extern bool nfs_sb_active(struct super_block *sb);
+2
fs/nfs/netns.h
··· 9 9 #include <linux/nfs4.h> 10 10 #include <net/net_namespace.h> 11 11 #include <net/netns/generic.h> 12 + #include <linux/sunrpc/stats.h> 12 13 13 14 struct bl_dev_msg { 14 15 int32_t status; ··· 35 34 struct nfs_netns_client *nfs_client; 36 35 spinlock_t nfs_client_lock; 37 36 ktime_t boot_time; 37 + struct rpc_stat rpcstats; 38 38 #ifdef CONFIG_PROC_FS 39 39 struct proc_dir_entry *proc_nfsfs; 40 40 #endif