Skip to contentSkip to conversation

NFSD: Using exp_get for export getting

PATCH In review Kinglong Mee 2 participants 3 messages Jun 10, 2014 – Jun 11, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSD: Using exp_get for export getting

Don't using cache_get besides export.h, using exp_get for export.

---
 fs/nfsd/export.c   | 2 +-
 fs/nfsd/export.h   | 3 ++-
 fs/nfsd/nfs4proc.c | 6 +++---
 fs/nfsd/nfsfh.c    | 3 +--
 fs/nfsd/vfs.c      | 3 +--
 5 files changed, 8 insertions(+), 9 deletions(-)
fs/nfsd/export.c +1 -1
index ef2d9d6..72ffd7c 100644
@@ -1253,7 +1253,7 @@ static int e_show(struct seq_file *m, void *p)
 		return 0;
 	}
 
-	cache_get(&exp->h);
+	exp_get(exp);
 	if (cache_check(cd, &exp->h, NULL))
 		return 0;
 	exp_put(exp);
fs/nfsd/export.h +2 -1
index cfeea85..04dc8c1 100644
@@ -101,9 +101,10 @@ static inline void exp_put(struct svc_export *exp)
 	cache_put(&exp->h, exp->cd);
 }
 
-static inline void exp_get(struct svc_export *exp)
+static inline struct svc_export *exp_get(struct svc_export *exp)
 {
 	cache_get(&exp->h);
+	return exp;
 }
 struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
 
fs/nfsd/nfs4proc.c +3 -3
index be67340..f3f0487 100644
@@ -177,7 +177,7 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
 	fh_put(dst);
 	dget(src->fh_dentry);
 	if (src->fh_export)
-		cache_get(&src->fh_export->h);
+		exp_get(src->fh_export);
 	*dst = *src;
 }
 
@@ -918,8 +918,8 @@ nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstat
 	default:
 		return nfserr_inval;
 	}
-	exp_get(cstate->current_fh.fh_export);
-	sin->sin_exp = cstate->current_fh.fh_export;
+
+	sin->sin_exp = exp_get(cstate->current_fh.fh_export);
 	fh_put(&cstate->current_fh);
 	return nfs_ok;
 }
fs/nfsd/nfsfh.c +1 -2
index ec83934..6f5cc76 100644
@@ -539,8 +539,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 		       dentry);
 
 	fhp->fh_dentry = dget(dentry); /* our internal copy */
-	fhp->fh_export = exp;
-	cache_get(&exp->h);
+	fhp->fh_export = exp_get(exp);
 
 	if (fhp->fh_handle.fh_version == 0xca) {
 		/* old style filehandle please */
fs/nfsd/vfs.c +1 -2
index 7498099..df7cf61 100644
@@ -189,8 +189,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
 
 	dparent = fhp->fh_dentry;
-	exp  = fhp->fh_export;
-	exp_get(exp);
+	exp = exp_get(fhp->fh_export);
 
 	/* Lookup the name, but don't follow links */
 	if (isdotent(name, len)) {
Signature · 1 line
1.9.3
#1 lore raw
Quoted 1 line · Kinglong Mee

Don't using cache_get besides export.h, using exp_get for export.

I'm not even sure what difference it makes.

I guess it's a little cleaner.

OK, applying this (and preceding three patches) for 3.17. May be a little while before I get a 3.17 branch actually pushed out.

--b.

Quoted 94 lines
---
 fs/nfsd/export.c   | 2 +-
 fs/nfsd/export.h   | 3 ++-
 fs/nfsd/nfs4proc.c | 6 +++---
 fs/nfsd/nfsfh.c    | 3 +--
 fs/nfsd/vfs.c      | 3 +--
 5 files changed, 8 insertions(+), 9 deletions(-)
fs/nfsd/export.c +1 -1
index ef2d9d6..72ffd7c 100644
@@ -1253,7 +1253,7 @@ static int e_show(struct seq_file *m, void *p)
 		return 0;
 	}
 
-	cache_get(&exp->h);
+	exp_get(exp);
 	if (cache_check(cd, &exp->h, NULL))
 		return 0;
 	exp_put(exp);
fs/nfsd/export.h +2 -1
index cfeea85..04dc8c1 100644
@@ -101,9 +101,10 @@ static inline void exp_put(struct svc_export *exp)
 	cache_put(&exp->h, exp->cd);
 }
 
-static inline void exp_get(struct svc_export *exp)
+static inline struct svc_export *exp_get(struct svc_export *exp)
 {
 	cache_get(&exp->h);
+	return exp;
 }
 struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
 
fs/nfsd/nfs4proc.c +3 -3
index be67340..f3f0487 100644
@@ -177,7 +177,7 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
 	fh_put(dst);
 	dget(src->fh_dentry);
 	if (src->fh_export)
-		cache_get(&src->fh_export->h);
+		exp_get(src->fh_export);
 	*dst = *src;
 }
 
@@ -918,8 +918,8 @@ nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstat
 	default:
 		return nfserr_inval;
 	}
-	exp_get(cstate->current_fh.fh_export);
-	sin->sin_exp = cstate->current_fh.fh_export;
+
+	sin->sin_exp = exp_get(cstate->current_fh.fh_export);
 	fh_put(&cstate->current_fh);
 	return nfs_ok;
 }
fs/nfsd/nfsfh.c +1 -2
index ec83934..6f5cc76 100644
@@ -539,8 +539,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 		       dentry);
 
 	fhp->fh_dentry = dget(dentry); /* our internal copy */
-	fhp->fh_export = exp;
-	cache_get(&exp->h);
+	fhp->fh_export = exp_get(exp);
 
 	if (fhp->fh_handle.fh_version == 0xca) {
 		/* old style filehandle please */
fs/nfsd/vfs.c +1 -2
index 7498099..df7cf61 100644
@@ -189,8 +189,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
 
 	dparent = fhp->fh_dentry;
-	exp  = fhp->fh_export;
-	exp_get(exp);
+	exp = exp_get(fhp->fh_export);
 
 	/* Lookup the name, but don't follow links */
 	if (isdotent(name, len)) {
Signature · 1 line
1.9.3
#2 lore raw
Quoted 6 lines · J. Bruce Fields
Quoted 1 line · Kinglong Mee

Don't using cache_get besides export.h, using exp_get for export.

I'm not even sure what difference it makes.

I guess it's a little cleaner.

Yes, it's just a cleaner.

Quoted 3 lines

OK, applying this (and preceding three patches) for 3.17. May be a little while before I get a 3.17 branch actually pushed out.

Got it, thank you.

thanks,
Kinglong Mee

Quoted 98 lines

--b.

Quoted 94 lines
---
 fs/nfsd/export.c   | 2 +-
 fs/nfsd/export.h   | 3 ++-
 fs/nfsd/nfs4proc.c | 6 +++---
 fs/nfsd/nfsfh.c    | 3 +--
 fs/nfsd/vfs.c      | 3 +--
 5 files changed, 8 insertions(+), 9 deletions(-)
fs/nfsd/export.c +1 -1
index ef2d9d6..72ffd7c 100644
@@ -1253,7 +1253,7 @@ static int e_show(struct seq_file *m, void *p)
 		return 0;
 	}
 
-	cache_get(&exp->h);
+	exp_get(exp);
 	if (cache_check(cd, &exp->h, NULL))
 		return 0;
 	exp_put(exp);
fs/nfsd/export.h +2 -1
index cfeea85..04dc8c1 100644
@@ -101,9 +101,10 @@ static inline void exp_put(struct svc_export *exp)
 	cache_put(&exp->h, exp->cd);
 }
 
-static inline void exp_get(struct svc_export *exp)
+static inline struct svc_export *exp_get(struct svc_export *exp)
 {
 	cache_get(&exp->h);
+	return exp;
 }
 struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
 
fs/nfsd/nfs4proc.c +3 -3
index be67340..f3f0487 100644
@@ -177,7 +177,7 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
 	fh_put(dst);
 	dget(src->fh_dentry);
 	if (src->fh_export)
-		cache_get(&src->fh_export->h);
+		exp_get(src->fh_export);
 	*dst = *src;
 }
 
@@ -918,8 +918,8 @@ nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstat
 	default:
 		return nfserr_inval;
 	}
-	exp_get(cstate->current_fh.fh_export);
-	sin->sin_exp = cstate->current_fh.fh_export;
+
+	sin->sin_exp = exp_get(cstate->current_fh.fh_export);
 	fh_put(&cstate->current_fh);
 	return nfs_ok;
 }
fs/nfsd/nfsfh.c +1 -2
index ec83934..6f5cc76 100644
@@ -539,8 +539,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 		       dentry);
 
 	fhp->fh_dentry = dget(dentry); /* our internal copy */
-	fhp->fh_export = exp;
-	cache_get(&exp->h);
+	fhp->fh_export = exp_get(exp);
 
 	if (fhp->fh_handle.fh_version == 0xca) {
 		/* old style filehandle please */
fs/nfsd/vfs.c +1 -2
index 7498099..df7cf61 100644
@@ -189,8 +189,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
 
 	dparent = fhp->fh_dentry;
-	exp  = fhp->fh_export;
-	exp_get(exp);
+	exp = exp_get(fhp->fh_export);
 
 	/* Lookup the name, but don't follow links */
 	if (isdotent(name, len)) {
Signature · 1 line
1.9.3