Skip to contentSkip to conversation

kNFSd - 4 of 8 - Add some tracing when showing the content of an RPC cache.

PATCH New NeilBrown 1 participant 1 message Jun 24, 2003

Subsystems (3)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 4 of 8 - Add some tracing when showing the content of an RPC cache.

### Comments for ChangeSet

The /proc/net/rpc/*/content files now will show entries that are still in the cache, but are either expired or negative, as comment.

ip_map_show is enhance to work if called with a negative or incomplete entry.

Also if cache debugging is enabled, the expiry time and refcount of each entry will be included in a comment.

----------- Diffstat output ------------

 ./include/linux/sunrpc/debug.h |    1 +
 ./net/sunrpc/cache.c           |    9 +++++++--
 ./net/sunrpc/svcauth_unix.c    |    8 +++++++-
 3 files changed, 15 insertions(+), 3 deletions(-)
include/linux/sunrpc/debug.h renamed from include/linux/sunrpc/debug.h~current~ +1 -0
diff ./include/linux/sunrpc/debug.h~current~ ./include/linux/sunrpc/debug.h
@@ -58,6 +58,7 @@ extern unsigned int		nlm_debug;
 # define dfprintk(fac, args...)	do { ifdebug(fac) printk(args); } while(0)
 # define RPC_IFDEBUG(x)		x
 #else
+# define ifdebug(fac)		if (0)
 # define dfprintk(fac, args...)	do ; while (0)
 # define RPC_IFDEBUG(x)
 #endif
net/sunrpc/cache.c renamed from net/sunrpc/cache.c~current~ +7 -2
diff ./net/sunrpc/cache.c~current~ ./net/sunrpc/cache.c
@@ -1063,10 +1063,15 @@ static int c_show(struct seq_file *m, vo
 	if (p == (void *)1)
 		return cd->cache_show(m, cd, NULL, pbuf);
 
+	ifdebug(CACHE)
+		seq_printf(m, "# expiry=%ld refcnt=%d\n",
+			   cp->expiry_time, atomic_read(&cp->refcnt));
 	cache_get(cp);
 	if (cache_check(cd, cp, NULL))
-		return 0;
-	cache_put(cp, cd);
+		/* cache_check does a cache_put on failure */
+		seq_printf(m, "# ");
+	else
+		cache_put(cp, cd);
 
 	return cd->cache_show(m, cd, cp, pbuf);
 }
net/sunrpc/svcauth_unix.c renamed from net/sunrpc/svcauth_unix.c~current~ +7 -1
diff ./net/sunrpc/svcauth_unix.c~current~ ./net/sunrpc/svcauth_unix.c
@@ -220,6 +220,7 @@ static int ip_map_show(struct seq_file *
 {
 	struct ip_map *im;
 	struct in_addr addr;
+	char *dom = "-no-domain-";
 
 	if (h == NULL) {
 		seq_puts(m, "#class IP domain\n");
@@ -228,13 +229,18 @@ static int ip_map_show(struct seq_file *
 	im = container_of(h, struct ip_map, h);
 	/* class addr domain */
 	addr = im->m_addr;
+
+	if (test_bit(CACHE_VALID, &h->flags) && 
+	    !test_bit(CACHE_NEGATIVE, &h->flags))
+		dom = im->m_client->h.name;
+
 	seq_printf(m, "%s %d.%d.%d.%d %s\n",
 		   im->m_class,
 		   htonl(addr.s_addr) >> 24 & 0xff,
 		   htonl(addr.s_addr) >> 16 & 0xff,
 		   htonl(addr.s_addr) >>  8 & 0xff,
 		   htonl(addr.s_addr) >>  0 & 0xff,
-		   im->m_client->h.name
+		   dom
 		   );
 	return 0;
 }

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs