Re: [PATH v3 5/5] nfsd41: use pinter to current stateid to avoid extra copy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-12-11 18:41, Tigran Mkrtchyan wrote:
> From: Tigran Mkrtchyan <kofemann@xxxxxxxxx>
> 
> 
> Signed-off-by: Tigran Mkrtchyan <kofemann@xxxxxxxxx>
> ---
>  fs/nfsd/nfs4proc.c  |    6 +-----
>  fs/nfsd/nfs4state.c |    7 +++----
>  fs/nfsd/xdr4.h      |    3 +--
>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index f2f7dfa..b7d1a7b 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1126,10 +1126,7 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp)
>  static void
>  nfsd4_clear_currentstateid(struct nfsd4_compound_state *cstate)
>  {
> -	if (cstate->has_stateid) {
> -		memset(&cstate->current_stateid, 0, sizeof(stateid_t));
> -		cstate->has_stateid = false;
> -	}
> +	cstate->current_stateid = NULL;
>  }
>  /*
>   * COMPOUND call.
> @@ -1244,7 +1241,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
>  		if (!op->status) {
>  			if (opdesc->op_flags & PROVIDES_CURRENT_STATEID) {
>  				opdesc->op_set_currentstateid(cstate, &op->u);
> -				cstate->has_stateid = true;
>  			}
>  
>  			if (opdesc->op_flags & CLEARS_CURRENT_STATEID)
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index d7b8f25..be77cd3 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4553,16 +4553,15 @@ nfs4_state_shutdown(void)
>  static void
>  get_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
>  {
> -	if (cstate->has_stateid && CURRENT_STATEID(stateid))
> -		memcpy(stateid, &cstate->current_stateid, sizeof(stateid_t));
> +	if (cstate->current_stateid && CURRENT_STATEID(stateid))
> +		memcpy(stateid, cstate->current_stateid, sizeof(stateid_t));
>  }
>  
>  static void
>  put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
>  {
>  	if (cstate->minorversion) {
> -		memcpy(&cstate->current_stateid, stateid, sizeof(stateid_t));
> -		cstate->has_stateid = true;
> +		cstate->current_stateid = stateid;
>  	}
>  }
>  
> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
> index b8435d20..0ad0846 100644
> --- a/fs/nfsd/xdr4.h
> +++ b/fs/nfsd/xdr4.h
> @@ -54,8 +54,7 @@ struct nfsd4_compound_state {
>  	size_t			iovlen;
>  	u32			minorversion;
>  	u32			status;
> -	stateid_t               current_stateid;
> -	bool	has_stateid;
> +	stateid_t	*current_stateid;

Certainly looks neat.  I'm all for squashing this part of the patchset,
or just all of it...

Better be defined as const stateid_t * so its contents would be read only
for its consumers.

Benny

>  };
>  
>  static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux