Commit 5d1acff159730770cbab68b19443518c92ab1000

Authored by David Howells
1 parent 7f8e05f60c

NFS: Display local caching state

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

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Daire Byrne <Daire.Byrne@framestore.com>

Showing 2 changed files with 19 additions and 3 deletions Side-by-side Diff

... ... @@ -1564,7 +1564,7 @@
1564 1564  
1565 1565 /* display header on line 1 */
1566 1566 if (v == &nfs_volume_list) {
1567   - seq_puts(m, "NV SERVER PORT DEV FSID\n");
  1567 + seq_puts(m, "NV SERVER PORT DEV FSID FSC\n");
1568 1568 return 0;
1569 1569 }
1570 1570 /* display one transport per line on subsequent lines */
1571 1571  
... ... @@ -1578,12 +1578,13 @@
1578 1578 (unsigned long long) server->fsid.major,
1579 1579 (unsigned long long) server->fsid.minor);
1580 1580  
1581   - seq_printf(m, "v%u %s %s %-7s %-17s\n",
  1581 + seq_printf(m, "v%u %s %s %-7s %-17s %s\n",
1582 1582 clp->rpc_ops->version,
1583 1583 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
1584 1584 rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT),
1585 1585 dev,
1586   - fsid);
  1586 + fsid,
  1587 + nfs_server_fscache_state(server));
1587 1588  
1588 1589 return 0;
1589 1590 }
... ... @@ -153,7 +153,17 @@
153 153 __nfs_readpage_to_fscache(inode, page, sync);
154 154 }
155 155  
  156 +/*
  157 + * indicate the client caching state as readable text
  158 + */
  159 +static inline const char *nfs_server_fscache_state(struct nfs_server *server)
  160 +{
  161 + if (server->fscache && (server->options & NFS_OPTION_FSCACHE))
  162 + return "yes";
  163 + return "no ";
  164 +}
156 165  
  166 +
157 167 #else /* CONFIG_NFS_FSCACHE */
158 168 static inline int nfs_fscache_register(void) { return 0; }
159 169 static inline void nfs_fscache_unregister(void) {}
... ... @@ -200,6 +210,11 @@
200 210 }
201 211 static inline void nfs_readpage_to_fscache(struct inode *inode,
202 212 struct page *page, int sync) {}
  213 +
  214 +static inline const char *nfs_server_fscache_state(struct nfs_server *server)
  215 +{
  216 + return "no ";
  217 +}
203 218  
204 219 #endif /* CONFIG_NFS_FSCACHE */
205 220 #endif /* _NFS_FSCACHE_H */