[PATCH 36/37] NFS: Display local caching state

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Howells
Date: Wednesday, February 20, 2008 - 9:09 am

Display the local caching state in /proc/fs/nfsfs/volumes.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/nfs/client.c  |    7 ++++---
 fs/nfs/fscache.h |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)


diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 51e9346..d67d52f 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1451,7 +1451,7 @@ static int nfs_volume_list_show(struct seq_file *m, void *v)
 
 	/* display header on line 1 */
 	if (v == &nfs_volume_list) {
-		seq_puts(m, "NV SERVER   PORT DEV     FSID\n");
+		seq_puts(m, "NV SERVER   PORT DEV     FSID              FSC\n");
 		return 0;
 	}
 	/* display one transport per line on subsequent lines */
@@ -1465,12 +1465,13 @@ static int nfs_volume_list_show(struct seq_file *m, void *v)
 		 (unsigned long long) server->fsid.major,
 		 (unsigned long long) server->fsid.minor);
 
-	seq_printf(m, "v%u %s %s %-7s %-17s\n",
+	seq_printf(m, "v%u %s %s %-7s %-17s %s\n",
 		   clp->rpc_ops->version,
 		   rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
 		   rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT),
 		   dev,
-		   fsid);
+		   fsid,
+		   nfs_server_fscache_state(server));
 
 	return 0;
 }
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 6264cd8..5f7806f 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -146,6 +146,16 @@ static inline void nfs_readpage_to_fscache(struct inode *inode,
 		__nfs_readpage_to_fscache(inode, page, sync);
 }
 
+/*
+ * indicate the client caching state as readable text
+ */
+static inline const char *nfs_server_fscache_state(struct nfs_server *server)
+{
+	if (server->fscache && (server->options & NFS_OPTION_FSCACHE))
+		return "yes";
+	return "no ";
+}
+
 
 #else /* CONFIG_NFS_FSCACHE */
 static inline int nfs_fscache_register(void) { return 0; }
@@ -195,5 +205,10 @@ static inline int nfs_readpages_from_fscache(struct nfs_open_context *ctx,
 static inline void nfs_readpage_to_fscache(struct inode *inode,
 					   struct page *page, int sync) {}
 
+static inline const char *nfs_server_fscache_state(struct nfs_server *server)
+{
+	return "no ";
+}
+
 #endif /* CONFIG_NFS_FSCACHE */
 #endif /* _NFS_FSCACHE_H */

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/37] Permit filesystem local caching, David Howells, (Wed Feb 20, 9:05 am)
[PATCH 19/37] CacheFiles: Export things for CacheFiles, David Howells, (Wed Feb 20, 9:07 am)
[PATCH 22/37] NFS: Add FS-Cache option bit and debug bit, David Howells, (Wed Feb 20, 9:07 am)
[PATCH 25/37] NFS: Define and create server-level objects, David Howells, (Wed Feb 20, 9:08 am)
[PATCH 28/37] NFS: Use local disk inode cache, David Howells, (Wed Feb 20, 9:08 am)
[PATCH 31/37] NFS: FS-Cache page management, David Howells, (Wed Feb 20, 9:08 am)
[PATCH 36/37] NFS: Display local caching state, David Howells, (Wed Feb 20, 9:09 am)
Re: [PATCH 00/37] Permit filesystem local caching, Serge E. Hallyn, (Wed Feb 20, 12:58 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Wed Feb 20, 1:11 pm)
Re: [PATCH 00/37] Permit filesystem local caching, Daniel Phillips, (Wed Feb 20, 8:07 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Thu Feb 21, 5:31 am)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Thu Feb 21, 7:55 am)
Re: [PATCH 00/37] Permit filesystem local caching, Kevin Coffman, (Thu Feb 21, 8:17 am)
Re: [PATCH 00/37] Permit filesystem local caching, Daniel Phillips, (Thu Feb 21, 3:44 pm)
RE: [PATCH 00/37] Permit filesystem local caching, Muntz, Daniel, (Thu Feb 21, 3:52 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Thu Feb 21, 4:33 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Thu Feb 21, 5:07 pm)
Re: [PATCH 00/37] Permit filesystem local caching, Daniel Phillips, (Thu Feb 21, 5:57 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Fri Feb 22, 5:48 am)
Re: [PATCH 00/37] Permit filesystem local caching, Chris Mason, (Fri Feb 22, 6:52 am)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Fri Feb 22, 9:12 am)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Fri Feb 22, 9:14 am)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Fri Feb 22, 9:47 am)
Re: [PATCH 00/37] Permit filesystem local caching, Daniel Phillips, (Fri Feb 22, 3:25 pm)
Re: [PATCH 00/37] Permit filesystem local caching, David Howells, (Fri Feb 22, 6:22 pm)