[pnfs] [PATCH 02/11] nfs41: remove redundant create_session parameter

Benny Halevy bhalevy at panasas.com
Sun Jul 13 06:54:40 EDT 2008


On Jul. 11, 2008, 17:39 +0300, andros at netapp.com wrote:
> From: Andy Adamson <andros at netapp.com>
> 
> Signed-off-by: Andy Adamson<andros at netapp.com>
> ---
>  fs/nfs/nfs41_session_recovery.c |    2 +-
>  fs/nfs/nfs4_fs.h                |    3 +--
>  fs/nfs/nfs4proc.c               |   24 +++++++++++-------------
>  3 files changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/nfs/nfs41_session_recovery.c b/fs/nfs/nfs41_session_recovery.c
> index 9d4041a..493268d 100644
> --- a/fs/nfs/nfs41_session_recovery.c
> +++ b/fs/nfs/nfs41_session_recovery.c
> @@ -110,7 +110,7 @@ static int session_reclaimer(void *arg)
>  		nfs41_reset_put_session(rec->session);
>  		nfs41_reset_init_session(rec->session);
>  	}
> -	ret = nfs4_proc_create_session(rec->session->clp, rec->session, reset);
> +	ret = nfs4_proc_create_session(rec->session, reset);
>  	if (ret)
>  		goto out_error;
>  
> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
> index 55f62df..aa38968 100644
> --- a/fs/nfs/nfs4_fs.h
> +++ b/fs/nfs/nfs4_fs.h
> @@ -210,8 +210,7 @@ extern int nfs4_setup_sequence(struct nfs_client *clp,
>  	struct nfs41_sequence_res *res, int cache_reply, struct rpc_task *task);
>  extern void nfs4_put_session(struct nfs4_session **session);
>  extern struct nfs4_session *nfs4_alloc_session(void);
> -extern int nfs4_proc_create_session(struct nfs_client *, struct nfs4_session *,
> -				    int reset);
> +extern int nfs4_proc_create_session(struct nfs4_session *, int reset);
>  extern int nfs4_proc_destroy_session(struct nfs4_session *);
>  #endif /* CONFIG_NFS_V4_1 */
>  
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 560be00..b92eaf4 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -4700,32 +4700,31 @@ static void nfs4_adjust_channel_attrs(struct nfs4_channel_attrs *req_attrs,
>  	/* We ignore the rdma channel attributes */
>  }
>  
> -static int _nfs4_proc_create_session(struct nfs_client *clp,
> -				     struct nfs4_session *session,
> -				     struct rpc_clnt *clnt)
> +static int _nfs4_proc_create_session(struct nfs4_session *session)
>  {
>  	struct nfs41_create_session_args args = {
> -		.client = clp,
> +		.client = session->clp,
>  		.session = session,
>  		.cb_program = NFS4_CALLBACK,
>  	};
>  
>  	struct nfs41_create_session_res res = {
> -		.client = clp,
> +		.client = session->clp,
>  		.session = session,
>  	};
>  
>  	struct rpc_message msg = {
> -		.rpc_proc = nfs4_proc(clp, NFSPROC4_CLNT_CREATE_SESSION),
> +		.rpc_proc = nfs4_proc(session->clp,
> +				      NFSPROC4_CLNT_CREATE_SESSION),
>  		.rpc_argp = &args,
>  		.rpc_resp = &res,
>  	};
>  	int status;
>  
> -	nfs4_init_channel_attrs(clp, &args.fc_attrs, &args.bc_attrs);
> +	nfs4_init_channel_attrs(session->clp, &args.fc_attrs, &args.bc_attrs);

since session->clp is used three times here I suggest to put it
in a variable.  If that's ok with you I'll do that when submitting
this patch.

Benny

>  	args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);
>  
> -	status = rpc_call_sync(clnt, &msg, 0);
> +	status = rpc_call_sync(session->clnt, &msg, 0);
>  
>  	/* Set the negotiated values in the session's channel_attrs struct */
>  
> @@ -4737,7 +4736,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp,
>  		nfs41_set_session_valid(session);	/* Activate session */
>  
>  		/* Increment the clientid slot sequence id */
> -		clp->cl_seqid++;
> +		session->clp->cl_seqid++;
>  	}
>  
>  	return status;
> @@ -4748,18 +4747,17 @@ static int _nfs4_proc_create_session(struct nfs_client *clp,
>   * It is the responsibility of the caller to verify the session is
>   * expired before calling this routine.
>   */
> -int nfs4_proc_create_session(struct nfs_client *clp,
> -			     struct nfs4_session *session,
> -			     int reset)
> +int nfs4_proc_create_session(struct nfs4_session *session, int reset)
>  {
>  	int status;
>  	u32 *ptr;
>  	struct nfs_fsinfo fsinfo;
> +	struct nfs_client *clp = session->clp;
>  
>  	dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);
>  	BUG_ON(session == NULL);
>  
> -	status = _nfs4_proc_create_session(clp, session, clp->cl_rpcclient);
> +	status = _nfs4_proc_create_session(session);
>  	if (status)
>  		goto out;
>  



More information about the pNFS mailing list