[PATCH 16/22] NFS: Display local caching state

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Howells
Date: Friday, September 21, 2007 - 7:48 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 |   12 ++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 0de4db4..d350668 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1319,7 +1319,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 */
@@ -1333,12 +1333,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%d %02x%02x%02x%02x %4hx %-7s %-17s\n",
+	seq_printf(m, "v%d %02x%02x%02x%02x %4hx %-7s %-17s %s\n",
 		   clp->cl_nfsversion,
 		   NIPQUAD(clp->cl_addr.sin_addr),
 		   ntohs(clp->cl_addr.sin_port),
 		   dev,
-		   fsid);
+		   fsid,
+		   nfs_server_fscache_state(server));
 
 	return 0;
 }
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 44bb0d1..77f3450 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -56,6 +56,17 @@ extern void __nfs_fscache_invalidate_page(struct page *, struct inode *);
 extern int nfs_fscache_release_page(struct page *, gfp_t);
 
 /*
+ * indicate the client caching state as readable text
+ */
+static inline const char *nfs_server_fscache_state(struct nfs_server *server)
+{
+	if (server->nfs_client->fscache &&
+	    (server->options & NFS_OPTION_FSCACHE))
+		return "yes";
+	return "no ";
+}
+
+/*
  * release the caching state associated with a page if undergoing complete page
  * invalidation
  */
@@ -110,6 +121,7 @@ static inline void nfs_fscache_unregister(void) {}
 static inline void nfs_fscache_get_client_cookie(struct nfs_client *clp) {}
 static inline void nfs4_fscache_get_client_cookie(struct nfs_client *clp) {}
 static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {}
+static inline const char *nfs_server_fscache_state(struct nfs_server *server) { return "no "; }
 
 static inline void nfs_fscache_init_fh_cookie(struct inode *inode) {}
 static inline void nfs_fscache_enable_fh_cookie(struct inode *inode) {}

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

Messages in current thread:
[PATCH 00/22] Introduce credential record, David Howells, (Fri Sep 21, 7:47 am)
[PATCH 01/22] CRED: Introduce a COW credentials record, David Howells, (Fri Sep 21, 7:47 am)
[PATCH 12/22] CacheFiles: Export things for CacheFiles, David Howells, (Fri Sep 21, 7:48 am)
[PATCH 14/22] NFS: Use local caching, David Howells, (Fri Sep 21, 7:48 am)
[PATCH 16/22] NFS: Display local caching state, David Howells, (Fri Sep 21, 7:48 am)
[PATCH 17/22] AFS: Add TestSetPageError(), David Howells, (Fri Sep 21, 7:48 am)
[PATCH 20/22] AFS: Implement shared-writable mmap, David Howells, (Fri Sep 21, 7:48 am)
[PATCH 22/22] FS-Cache: Make kAFS use FS-Cache, David Howells, (Fri Sep 21, 7:48 am)
Re: [PATCH 00/22] Introduce credential record, David Howells, (Fri Sep 21, 7:58 am)
Re: [PATCH 00/22] Introduce credential record, Casey Schaufler, (Fri Sep 21, 8:36 am)
Re: [PATCH 00/22] Introduce credential record, David Howells, (Fri Sep 21, 8:40 am)
Re: [PATCH 00/22] Introduce credential record, Casey Schaufler, (Fri Sep 21, 9:04 am)
Re: [PATCH 14/22] NFS: Use local caching, Peter Staubach, (Fri Sep 21, 10:00 am)
Re: [PATCH 00/22] Introduce credential record, David Howells, (Fri Sep 21, 4:18 pm)
Re: [PATCH 14/22] NFS: Use local caching, David Howells, (Fri Sep 21, 4:22 pm)
Re: [PATCH 14/22] NFS: Use local caching, David Howells, (Fri Sep 21, 4:37 pm)
Re: [PATCH 14/22] NFS: Use local caching, Peter Staubach, (Mon Sep 24, 6:31 am)