]> err.no Git - linux-2.6/commitdiff
NFS: report how long an NFS file system has been mounted
authorChuck Lever <cel@netapp.com>
Mon, 20 Mar 2006 18:44:15 +0000 (13:44 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 20 Mar 2006 18:44:15 +0000 (13:44 -0500)
Add a field in nfs_server to record a timestamp when a mount succeeds.
Report the number of seconds the file system has been mounted via
nfs_show_stats().

Test plan:
Mount an NFS file system, watch the mountstats reports and compare with
clock time.

Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/inode.c
include/linux/nfs_fs_sb.h

index 8ee74111e5197ce8cc84ead6717d655f6eb00a18..1b2d782374b59d9470fd2271f2240fde6ddcd189 100644 (file)
@@ -299,6 +299,9 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
                goto out_no_root;
        }
 
+       /* mount time stamp, in seconds */
+       server->mount_time = jiffies;
+
        /* Get some general file system info */
        if (server->namelen == 0 &&
            server->rpc_ops->pathconf(server, &server->fh, &pathinfo) >= 0)
@@ -674,6 +677,8 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
        seq_puts(m, mnt->mnt_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : "");
        nfs_show_mount_options(m, nfss, 1);
 
+       seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ);
+
        seq_printf(m, "\n\tcaps:\t");
        seq_printf(m, "caps=0x%x", nfss->caps);
        seq_printf(m, ",wtmult=%d", nfss->wtmult);
index d65e69a06b7237d4dd78a52a2f6d1b394b7ac220..65dec21af7741e1102d9f90acaf8d574c2c0fd10 100644 (file)
@@ -35,6 +35,7 @@ struct nfs_server {
        char *                  hostname;       /* remote hostname */
        struct nfs_fh           fh;
        struct sockaddr_in      addr;
+       unsigned long           mount_time;     /* when this fs was mounted */
 #ifdef CONFIG_NFS_V4
        /* Our own IP address, as a null-terminated string.
         * This is used to generate the clientid, and the callback address.