SUNRPC: Remove the rpc_client->cl_dentry

It is now redundant.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust 2013-08-26 17:44:26 -04:00
parent 2127d82af3
commit c36dcfe1f7
4 changed files with 26 additions and 25 deletions

View file

@ -57,7 +57,6 @@ struct rpc_clnt {
int cl_nodelen; /* nodename length */ int cl_nodelen; /* nodename length */
char cl_nodename[UNX_MAXNODENAME]; char cl_nodename[UNX_MAXNODENAME];
struct rpc_pipe_dir_head cl_pipedir_objects; struct rpc_pipe_dir_head cl_pipedir_objects;
struct dentry * cl_dentry;
struct rpc_clnt * cl_parent; /* Points to parent of clones */ struct rpc_clnt * cl_parent; /* Points to parent of clones */
struct rpc_rtt cl_rtt_default; struct rpc_rtt cl_rtt_default;
struct rpc_timeout cl_timeout_default; struct rpc_timeout cl_timeout_default;

View file

@ -94,7 +94,7 @@ extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
struct rpc_clnt; struct rpc_clnt;
extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *); extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
extern int rpc_remove_client_dir(struct dentry *, struct rpc_clnt *); extern int rpc_remove_client_dir(struct rpc_clnt *);
extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh); extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo, extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,

View file

@ -102,9 +102,7 @@ static void rpc_unregister_client(struct rpc_clnt *clnt)
static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
{ {
if (clnt->cl_dentry) rpc_remove_client_dir(clnt);
rpc_remove_client_dir(clnt->cl_dentry, clnt);
clnt->cl_dentry = NULL;
} }
static void rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) static void rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
@ -154,14 +152,11 @@ rpc_setup_pipedir(struct super_block *pipefs_sb, struct rpc_clnt *clnt)
{ {
struct dentry *dentry; struct dentry *dentry;
if (clnt->cl_program->pipe_dir_name == NULL) if (clnt->cl_program->pipe_dir_name != NULL) {
goto out; dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt);
clnt->cl_dentry = NULL; if (IS_ERR(dentry))
dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt); return PTR_ERR(dentry);
if (IS_ERR(dentry)) }
return PTR_ERR(dentry);
clnt->cl_dentry = dentry;
out:
return 0; return 0;
} }
@ -170,11 +165,18 @@ static int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event)
if (clnt->cl_program->pipe_dir_name == NULL) if (clnt->cl_program->pipe_dir_name == NULL)
return 1; return 1;
if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || switch (event) {
((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) case RPC_PIPEFS_MOUNT:
return 1; if (clnt->cl_pipedir_objects.pdh_dentry != NULL)
if ((event == RPC_PIPEFS_MOUNT) && atomic_read(&clnt->cl_count) == 0) return 1;
return 1; if (atomic_read(&clnt->cl_count) == 0)
return 1;
break;
case RPC_PIPEFS_UMOUNT:
if (clnt->cl_pipedir_objects.pdh_dentry == NULL)
return 1;
break;
}
return 0; return 0;
} }
@ -191,7 +193,6 @@ static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event,
return -ENOENT; return -ENOENT;
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return PTR_ERR(dentry); return PTR_ERR(dentry);
clnt->cl_dentry = dentry;
break; break;
case RPC_PIPEFS_UMOUNT: case RPC_PIPEFS_UMOUNT:
__rpc_clnt_remove_pipedir(clnt); __rpc_clnt_remove_pipedir(clnt);

View file

@ -1055,15 +1055,16 @@ struct dentry *rpc_create_client_dir(struct dentry *dentry,
/** /**
* rpc_remove_client_dir - Remove a directory created with rpc_create_client_dir() * rpc_remove_client_dir - Remove a directory created with rpc_create_client_dir()
* @dentry: dentry for the pipe
* @rpc_client: rpc_client for the pipe * @rpc_client: rpc_client for the pipe
*/ */
int rpc_remove_client_dir(struct dentry *dentry, struct rpc_clnt *rpc_client) int rpc_remove_client_dir(struct rpc_clnt *rpc_client)
{ {
if (rpc_client->cl_pipedir_objects.pdh_dentry) { struct dentry *dentry = rpc_client->cl_pipedir_objects.pdh_dentry;
rpc_destroy_pipe_dir_objects(&rpc_client->cl_pipedir_objects);
rpc_client->cl_pipedir_objects.pdh_dentry = NULL; if (dentry == NULL)
} return 0;
rpc_destroy_pipe_dir_objects(&rpc_client->cl_pipedir_objects);
rpc_client->cl_pipedir_objects.pdh_dentry = NULL;
return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate); return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate);
} }