nfsd: no need to unhash_stid before free
Subsystems (2)
PATCH 1/1 nfsd: no need to unhash_stid before free
idr_remove is about to be called before kmem_cache_free so unhashing it is redundant
--- fs/nfsd/nfs4state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/nfsd/nfs4state.c +2 -5
@@ -668,7 +668,6 @@ static void unhash_open_stateid(struct nfs4_ol_stateid *stp)static void release_open_stateid (struct nfs4_ol_stateid *stp) {unhash_open_stateid (stp); -unhash_stid (&stp->st_stid);free_generic_stateid (stp); }
@@ -690,7 +689,6 @@ static void release_last_closed_stateid(struct nfs4_openowner *oo)struct nfs4_ol_stateid *s = oo->oo_last_closed_stid;if (s) { -unhash_stid (&s->st_stid);free_generic_stateid (s); oo->oo_last_closed_stid =NULL ; }
@@ -3998,10 +3996,9 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)nfsd4_close_open_stateid (stp); -if (cstate->minorversion) { -unhash_stid (&stp->st_stid); +if (cstate->minorversion)free_generic_stateid (stp); - }else +else oo->oo_last_closed_stid = stp;if (list_empty (&oo->oo_owner.so_stateids)) {
Signature · 1 line
1.8.3.1
Quoted 2 lines · Benny Halevy
idr_removeis about to be called beforekmem_cache_freeso unhashing it is redundant
This leaves only two unhash_stid callers, in release_lock_stateid and unhash_stid, both called just before destroying the stateid, so perhaps we should remove those and unhash_stid?
--b.
Quoted 42 lines
Signed-off-by Benny Halevy <[email protected]>--- fs/nfsd/nfs4state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/nfsd/nfs4state.c +2
-5@@ -668,7 +668,6 @@ static void unhash_open_stateid(struct nfs4_ol_stateid *stp)static void release_open_stateid (struct nfs4_ol_stateid *stp) {unhash_open_stateid (stp); -unhash_stid (&stp->st_stid);free_generic_stateid (stp); }@@ -690,7 +689,6 @@ static void release_last_closed_stateid(struct nfs4_openowner *oo)struct nfs4_ol_stateid *s = oo->oo_last_closed_stid;if (s) { -unhash_stid (&s->st_stid);free_generic_stateid (s); oo->oo_last_closed_stid =NULL ; }@@ -3998,10 +3996,9 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)nfsd4_close_open_stateid (stp); -if (cstate->minorversion) { -unhash_stid (&stp->st_stid); +if (cstate->minorversion)free_generic_stateid (stp); - }else +else oo->oo_last_closed_stid = stp;if (list_empty (&oo->oo_owner.so_stateids)) {Signature · 1 line
1.8.3.1
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Benny Halevy
idr_removeis about to be called beforekmem_cache_freeso unhashing it is redundantThis leaves only two
unhash_stidcallers, inrelease_lock_stateidandunhash_stid, both called just before destroying the stateid, so perhaps we should remove those andunhash_stid?
In my state lock elimination patchset I actually keep using unhash_stid after refactoring non-blocking unhashing from the blocking release so I don't think it's worth it to remove the call.
That said, we can still open code it but encapsulating the assignment in unhash_stid() which the compiler can inline anyway seems cleaner to me.
Benny
Quoted 50 lines
--b.
Quoted 42 lines
Signed-off-by Benny Halevy <[email protected]>--- fs/nfsd/nfs4state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/nfsd/nfs4state.c +2
-5@@ -668,7 +668,6 @@ static void unhash_open_stateid(struct nfs4_ol_stateid *stp)static void release_open_stateid (struct nfs4_ol_stateid *stp) {unhash_open_stateid (stp); -unhash_stid (&stp->st_stid);free_generic_stateid (stp); }@@ -690,7 +689,6 @@ static void release_last_closed_stateid(struct nfs4_openowner *oo)struct nfs4_ol_stateid *s = oo->oo_last_closed_stid;if (s) { -unhash_stid (&s->st_stid);free_generic_stateid (s); oo->oo_last_closed_stid =NULL ; }@@ -3998,10 +3996,9 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)nfsd4_close_open_stateid (stp); -if (cstate->minorversion) { -unhash_stid (&stp->st_stid); +if (cstate->minorversion)free_generic_stateid (stp); - }else +else oo->oo_last_closed_stid = stp;if (list_empty (&oo->oo_owner.so_stateids)) {Signature · 1 line
1.8.3.1--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Benny Halevy
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Benny Halevy
idr_removeis about to be called beforekmem_cache_freeso unhashing it is redundantThis leaves only two
unhash_stidcallers, inrelease_lock_stateidandunhash_stid, both called just before destroying the stateid, so perhaps we should remove those andunhash_stid?
Quoted 5 lines
In my state lock elimination patchset I actually keep using
unhash_stidafter refactoring non-blocking unhashing from the blocking release so I don't think it's worth it to remove the call.
That said, we can still open code it but encapsulating the assignment inunhash_stid()which the compiler can inline anyway seems cleaner to me.
OK, sure, sounds fine.
--b.
Quoted 57 lines
Benny
Quoted 41 lines
--b.
Quoted 38 lines
Signed-off-by Benny Halevy <[email protected]>--- fs/nfsd/nfs4state.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/nfsd/nfs4state.c +2
-5@@ -668,7 +668,6 @@ static void unhash_open_stateid(struct nfs4_ol_stateid *stp)static void release_open_stateid (struct nfs4_ol_stateid *stp) {unhash_open_stateid (stp); -unhash_stid (&stp->st_stid);free_generic_stateid (stp); }@@ -690,7 +689,6 @@ static void release_last_closed_stateid(struct nfs4_openowner *oo)struct nfs4_ol_stateid *s = oo->oo_last_closed_stid;if (s) { -unhash_stid (&s->st_stid);free_generic_stateid (s); oo->oo_last_closed_stid =NULL ; }@@ -3998,10 +3996,9 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)nfsd4_close_open_stateid (stp); -if (cstate->minorversion) { -unhash_stid (&stp->st_stid); +if (cstate->minorversion)free_generic_stateid (stp); - }else +else oo->oo_last_closed_stid = stp;Quoted 9 lines
Quoted 4 lines
fs/nfsd/nfs4state.c +0
-0if (list_empty (&oo->oo_owner.so_stateids)) {Signature · 1 line
1.8.3.1--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html