diff mbox

[1/5,v3] NFSD: Remove duplicate initialization of file_lock

Message ID 53ED4E2F.2010701@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee Aug. 15, 2014, 12:02 a.m. UTC
locks_alloc_lock() has initialize struct file_lock,
don't need re-initialize it by locks_init_lock().

v3: A new patch isn't exit in v2/v1.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/nfs4state.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jeff Layton Aug. 15, 2014, 10:57 a.m. UTC | #1
On Fri, 15 Aug 2014 08:02:55 +0800
Kinglong Mee <kinglongmee@gmail.com> wrote:

> locks_alloc_lock() has initialize struct file_lock,
> don't need re-initialize it by locks_init_lock().
> 
> v3: A new patch isn't exit in v2/v1.
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/nfs4state.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 2e80a59..98edf97 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3759,7 +3759,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_file *fp, int flag)
>  	fl = locks_alloc_lock();
>  	if (!fl)
>  		return NULL;
> -	locks_init_lock(fl);
>  	fl->fl_lmops = &nfsd_lease_mng_ops;
>  	fl->fl_flags = FL_DELEG;
>  	fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK;
> @@ -5210,7 +5209,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  	}
>  
>  	fp = lock_stp->st_stid.sc_file;
> -	locks_init_lock(file_lock);
>  	switch (lock->lk_type) {
>  		case NFS4_READ_LT:
>  		case NFS4_READW_LT:
> @@ -5354,7 +5352,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  		status = nfserr_jukebox;
>  		goto out;
>  	}
> -	locks_init_lock(file_lock);
> +
>  	switch (lockt->lt_type) {
>  		case NFS4_READ_LT:
>  		case NFS4_READW_LT:
> @@ -5432,7 +5430,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  		status = nfserr_jukebox;
>  		goto fput;
>  	}
> -	locks_init_lock(file_lock);
> +
>  	file_lock->fl_type = F_UNLCK;
>  	file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner);
>  	file_lock->fl_pid = current->tgid;

Bruce, since this is an nfsd patch, do you mind picking this one up?

Reviewed-by: Jeff Layton <jlayton@primarydata.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Bruce Fields Aug. 15, 2014, 9:35 p.m. UTC | #2
On Fri, Aug 15, 2014 at 06:57:41AM -0400, Jeff Layton wrote:
> On Fri, 15 Aug 2014 08:02:55 +0800
> Kinglong Mee <kinglongmee@gmail.com> wrote:
> 
> > locks_alloc_lock() has initialize struct file_lock,
> > don't need re-initialize it by locks_init_lock().
> > 
> > v3: A new patch isn't exit in v2/v1.
> > 
> > Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> > ---
> >  fs/nfsd/nfs4state.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index 2e80a59..98edf97 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -3759,7 +3759,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_file *fp, int flag)
> >  	fl = locks_alloc_lock();
> >  	if (!fl)
> >  		return NULL;
> > -	locks_init_lock(fl);
> >  	fl->fl_lmops = &nfsd_lease_mng_ops;
> >  	fl->fl_flags = FL_DELEG;
> >  	fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK;
> > @@ -5210,7 +5209,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> >  	}
> >  
> >  	fp = lock_stp->st_stid.sc_file;
> > -	locks_init_lock(file_lock);
> >  	switch (lock->lk_type) {
> >  		case NFS4_READ_LT:
> >  		case NFS4_READW_LT:
> > @@ -5354,7 +5352,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> >  		status = nfserr_jukebox;
> >  		goto out;
> >  	}
> > -	locks_init_lock(file_lock);
> > +
> >  	switch (lockt->lt_type) {
> >  		case NFS4_READ_LT:
> >  		case NFS4_READW_LT:
> > @@ -5432,7 +5430,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> >  		status = nfserr_jukebox;
> >  		goto fput;
> >  	}
> > -	locks_init_lock(file_lock);
> > +
> >  	file_lock->fl_type = F_UNLCK;
> >  	file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner);
> >  	file_lock->fl_pid = current->tgid;
> 
> Bruce, since this is an nfsd patch, do you mind picking this one up?
> 
> Reviewed-by: Jeff Layton <jlayton@primarydata.com>

Yep, got it, thanks!

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2e80a59..98edf97 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3759,7 +3759,6 @@  static struct file_lock *nfs4_alloc_init_lease(struct nfs4_file *fp, int flag)
 	fl = locks_alloc_lock();
 	if (!fl)
 		return NULL;
-	locks_init_lock(fl);
 	fl->fl_lmops = &nfsd_lease_mng_ops;
 	fl->fl_flags = FL_DELEG;
 	fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK;
@@ -5210,7 +5209,6 @@  nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	}
 
 	fp = lock_stp->st_stid.sc_file;
-	locks_init_lock(file_lock);
 	switch (lock->lk_type) {
 		case NFS4_READ_LT:
 		case NFS4_READW_LT:
@@ -5354,7 +5352,7 @@  nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		status = nfserr_jukebox;
 		goto out;
 	}
-	locks_init_lock(file_lock);
+
 	switch (lockt->lt_type) {
 		case NFS4_READ_LT:
 		case NFS4_READW_LT:
@@ -5432,7 +5430,7 @@  nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		status = nfserr_jukebox;
 		goto fput;
 	}
-	locks_init_lock(file_lock);
+
 	file_lock->fl_type = F_UNLCK;
 	file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner);
 	file_lock->fl_pid = current->tgid;