forked from mirrors/linux
		
	SUNRPC: Add an identifier for struct rpc_clnt
Add an identifier in order to aid debugging. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
		
							parent
							
								
									8d1018c774
								
							
						
					
					
						commit
						2f048db468
					
				
					 2 changed files with 26 additions and 0 deletions
				
			
		| 
						 | 
					@ -33,6 +33,7 @@ struct rpc_inode;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct rpc_clnt {
 | 
					struct rpc_clnt {
 | 
				
			||||||
	atomic_t		cl_count;	/* Number of references */
 | 
						atomic_t		cl_count;	/* Number of references */
 | 
				
			||||||
 | 
						unsigned int		cl_clid;	/* client id */
 | 
				
			||||||
	struct list_head	cl_clients;	/* Global list of clients */
 | 
						struct list_head	cl_clients;	/* Global list of clients */
 | 
				
			||||||
	struct list_head	cl_tasks;	/* List of tasks */
 | 
						struct list_head	cl_tasks;	/* List of tasks */
 | 
				
			||||||
	spinlock_t		cl_lock;	/* spinlock */
 | 
						spinlock_t		cl_lock;	/* spinlock */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -313,6 +313,24 @@ static int rpc_client_register(const struct rpc_create_args *args,
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static DEFINE_IDA(rpc_clids);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int rpc_alloc_clid(struct rpc_clnt *clnt)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int clid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clid = ida_simple_get(&rpc_clids, 0, 0, GFP_KERNEL);
 | 
				
			||||||
 | 
						if (clid < 0)
 | 
				
			||||||
 | 
							return clid;
 | 
				
			||||||
 | 
						clnt->cl_clid = clid;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void rpc_free_clid(struct rpc_clnt *clnt)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						ida_simple_remove(&rpc_clids, clnt->cl_clid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
 | 
					static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
 | 
				
			||||||
		struct rpc_xprt *xprt,
 | 
							struct rpc_xprt *xprt,
 | 
				
			||||||
		struct rpc_clnt *parent)
 | 
							struct rpc_clnt *parent)
 | 
				
			||||||
| 
						 | 
					@ -343,6 +361,10 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
 | 
				
			||||||
		goto out_err;
 | 
							goto out_err;
 | 
				
			||||||
	clnt->cl_parent = parent ? : clnt;
 | 
						clnt->cl_parent = parent ? : clnt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err = rpc_alloc_clid(clnt);
 | 
				
			||||||
 | 
						if (err)
 | 
				
			||||||
 | 
							goto out_no_clid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rcu_assign_pointer(clnt->cl_xprt, xprt);
 | 
						rcu_assign_pointer(clnt->cl_xprt, xprt);
 | 
				
			||||||
	clnt->cl_procinfo = version->procs;
 | 
						clnt->cl_procinfo = version->procs;
 | 
				
			||||||
	clnt->cl_maxproc  = version->nrprocs;
 | 
						clnt->cl_maxproc  = version->nrprocs;
 | 
				
			||||||
| 
						 | 
					@ -386,6 +408,8 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
 | 
				
			||||||
out_no_path:
 | 
					out_no_path:
 | 
				
			||||||
	rpc_free_iostats(clnt->cl_metrics);
 | 
						rpc_free_iostats(clnt->cl_metrics);
 | 
				
			||||||
out_no_stats:
 | 
					out_no_stats:
 | 
				
			||||||
 | 
						rpc_free_clid(clnt);
 | 
				
			||||||
 | 
					out_no_clid:
 | 
				
			||||||
	kfree(clnt);
 | 
						kfree(clnt);
 | 
				
			||||||
out_err:
 | 
					out_err:
 | 
				
			||||||
	rpciod_down();
 | 
						rpciod_down();
 | 
				
			||||||
| 
						 | 
					@ -646,6 +670,7 @@ rpc_free_client(struct rpc_clnt *clnt)
 | 
				
			||||||
	clnt->cl_metrics = NULL;
 | 
						clnt->cl_metrics = NULL;
 | 
				
			||||||
	xprt_put(rcu_dereference_raw(clnt->cl_xprt));
 | 
						xprt_put(rcu_dereference_raw(clnt->cl_xprt));
 | 
				
			||||||
	rpciod_down();
 | 
						rpciod_down();
 | 
				
			||||||
 | 
						rpc_free_clid(clnt);
 | 
				
			||||||
	kfree(clnt);
 | 
						kfree(clnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue