Commit d9c6a4e4 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Add some tracing when showing the content of an RPC cache.

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.
parent cc6eb5ca
......@@ -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
......
......@@ -1063,10 +1063,15 @@ static int c_show(struct seq_file *m, void *p)
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);
}
......
......@@ -220,6 +220,7 @@ static int ip_map_show(struct seq_file *m,
{
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 *m,
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment