Skip to contentSkip to conversation

knfsd: repcache: minor cleanups

PATCH In review Greg Banks 1 participant 1 message Oct 11, 2006

Subsystems (2)
lore
Share & tools
lore

Greg Banks

author
#0 lore raw

PATCH 1/8 knfsd: repcache: minor cleanups

knfsd: Minor whitespace, formatting and comment changes to the duplicate request cache.

---

 fs/nfsd/nfscache.c         |   15 +++++++--------
 include/linux/nfsd/cache.h |    3 +--
 2 files changed, 8 insertions(+), 10 deletions(-)
fs/nfsd/nfscache.c +7 -8
Index: linux-git-20061009/fs/nfsd/nfscache.c
===================================================================
@@ -37,7 +37,7 @@ static int			cache_disabled = 1;
 
 static int	nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec);
 
-/* 
+/*
  * locking for the reply cache:
  * A cache entry is "single use" if c_state == RC_INPROG
  * Otherwise, it when accessing _prev or _next, the lock must be held.
@@ -52,9 +52,10 @@ nfsd_cache_init(void)
 
 	INIT_LIST_HEAD(&lru_head);
 	i = CACHESIZE;
-	while(i) {
+	while (i) {
 		rp = kmalloc(sizeof(*rp), GFP_KERNEL);
-		if (!rp) break;
+		if (!rp)
+			break;
 		list_add(&rp->c_lru, &lru_head);
 		rp->c_state = RC_UNUSED;
 		rp->c_type = RC_NOCACHE;
@@ -132,7 +133,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp
 				vers = rqstp->rq_vers,
 				proc = rqstp->rq_proc;
 	unsigned long		age;
-	int rtn;
+	int			rtn;
+	int			safe = 0;
 
 	rqstp->rq_cacherep = NULL;
 	if (cache_disabled || type == RC_NOCACHE) {
@@ -157,8 +159,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp
 	nfsdstats.rcmisses++;
 
 	/* This loop shouldn't take more than a few iterations normally */
-	{
-	int	safe = 0;
 	list_for_each_entry(rp, &lru_head, c_lru) {
 		if (rp->c_state != RC_INPROG)
 			break;
@@ -168,7 +168,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp
 			goto out;
 		}
 	}
-	}
 
 	/* This should not happen */
 	if (rp == NULL) {
@@ -269,7 +268,7 @@ nfsd_cache_update(struct svc_rqst *rqstp
 
 	len = resv->iov_len - ((char*)statp - (char*)resv->iov_base);
 	len >>= 2;
-	
+
 	/* Don't cache excessive amounts of data and XDR failures */
 	if (!statp || len > (256 >> 2)) {
 		rp->c_state = RC_UNUSED;
include/linux/nfsd/cache.h +1 -2
Index: linux-git-20061009/include/linux/nfsd/cache.h
===================================================================
@@ -15,8 +15,7 @@
 #include <linux/uio.h>
 
 /*
- * Representation of a reply cache entry. The first two members *must*
- * be hash_next and hash_prev.
+ * Representation of a reply cache entry.
  */
 struct svc_cacherep {
 	struct hlist_node	c_hash;
Signature · 13 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs