aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c103
1 files changed, 97 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 827d69255b1b..86b756f44e27 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -42,6 +42,7 @@
42#include "nfs4_fs.h" 42#include "nfs4_fs.h"
43#include "callback.h" 43#include "callback.h"
44#include "delegation.h" 44#include "delegation.h"
45#include "iostat.h"
45 46
46#define NFSDBG_FACILITY NFSDBG_VFS 47#define NFSDBG_FACILITY NFSDBG_VFS
47#define NFS_PARANOIA 1 48#define NFS_PARANOIA 1
@@ -65,6 +66,7 @@ static void nfs_clear_inode(struct inode *);
65static void nfs_umount_begin(struct super_block *); 66static void nfs_umount_begin(struct super_block *);
66static int nfs_statfs(struct super_block *, struct kstatfs *); 67static int nfs_statfs(struct super_block *, struct kstatfs *);
67static int nfs_show_options(struct seq_file *, struct vfsmount *); 68static int nfs_show_options(struct seq_file *, struct vfsmount *);
69static int nfs_show_stats(struct seq_file *, struct vfsmount *);
68static void nfs_zap_acl_cache(struct inode *); 70static void nfs_zap_acl_cache(struct inode *);
69 71
70static struct rpc_program nfs_program; 72static struct rpc_program nfs_program;
@@ -78,6 +80,7 @@ static struct super_operations nfs_sops = {
78 .clear_inode = nfs_clear_inode, 80 .clear_inode = nfs_clear_inode,
79 .umount_begin = nfs_umount_begin, 81 .umount_begin = nfs_umount_begin,
80 .show_options = nfs_show_options, 82 .show_options = nfs_show_options,
83 .show_stats = nfs_show_stats,
81}; 84};
82 85
83/* 86/*
@@ -290,6 +293,12 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
290 } 293 }
291 sb->s_root->d_op = server->rpc_ops->dentry_ops; 294 sb->s_root->d_op = server->rpc_ops->dentry_ops;
292 295
296 server->io_stats = nfs_alloc_iostats();
297 if (!server->io_stats) {
298 no_root_error = -ENOMEM;
299 goto out_no_root;
300 }
301
293 /* Get some general file system info */ 302 /* Get some general file system info */
294 if (server->namelen == 0 && 303 if (server->namelen == 0 &&
295 server->rpc_ops->pathconf(server, &server->fh, &pathinfo) >= 0) 304 server->rpc_ops->pathconf(server, &server->fh, &pathinfo) >= 0)
@@ -582,7 +591,7 @@ nfs_statfs(struct super_block *sb, struct kstatfs *buf)
582 591
583} 592}
584 593
585static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) 594static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, int showdefaults)
586{ 595{
587 static struct proc_nfs_info { 596 static struct proc_nfs_info {
588 int flag; 597 int flag;
@@ -598,20 +607,19 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
598 { 0, NULL, NULL } 607 { 0, NULL, NULL }
599 }; 608 };
600 struct proc_nfs_info *nfs_infop; 609 struct proc_nfs_info *nfs_infop;
601 struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
602 char buf[12]; 610 char buf[12];
603 char *proto; 611 char *proto;
604 612
605 seq_printf(m, ",vers=%d", nfss->rpc_ops->version); 613 seq_printf(m, ",vers=%d", nfss->rpc_ops->version);
606 seq_printf(m, ",rsize=%d", nfss->rsize); 614 seq_printf(m, ",rsize=%d", nfss->rsize);
607 seq_printf(m, ",wsize=%d", nfss->wsize); 615 seq_printf(m, ",wsize=%d", nfss->wsize);
608 if (nfss->acregmin != 3*HZ) 616 if (nfss->acregmin != 3*HZ || showdefaults)
609 seq_printf(m, ",acregmin=%d", nfss->acregmin/HZ); 617 seq_printf(m, ",acregmin=%d", nfss->acregmin/HZ);
610 if (nfss->acregmax != 60*HZ) 618 if (nfss->acregmax != 60*HZ || showdefaults)
611 seq_printf(m, ",acregmax=%d", nfss->acregmax/HZ); 619 seq_printf(m, ",acregmax=%d", nfss->acregmax/HZ);
612 if (nfss->acdirmin != 30*HZ) 620 if (nfss->acdirmin != 30*HZ || showdefaults)
613 seq_printf(m, ",acdirmin=%d", nfss->acdirmin/HZ); 621 seq_printf(m, ",acdirmin=%d", nfss->acdirmin/HZ);
614 if (nfss->acdirmax != 60*HZ) 622 if (nfss->acdirmax != 60*HZ || showdefaults)
615 seq_printf(m, ",acdirmax=%d", nfss->acdirmax/HZ); 623 seq_printf(m, ",acdirmax=%d", nfss->acdirmax/HZ);
616 for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) { 624 for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) {
617 if (nfss->flags & nfs_infop->flag) 625 if (nfss->flags & nfs_infop->flag)
@@ -633,8 +641,89 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
633 seq_printf(m, ",proto=%s", proto); 641 seq_printf(m, ",proto=%s", proto);
634 seq_printf(m, ",timeo=%lu", 10U * nfss->retrans_timeo / HZ); 642 seq_printf(m, ",timeo=%lu", 10U * nfss->retrans_timeo / HZ);
635 seq_printf(m, ",retrans=%u", nfss->retrans_count); 643 seq_printf(m, ",retrans=%u", nfss->retrans_count);
644}
645
646static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
647{
648 struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
649
650 nfs_show_mount_options(m, nfss, 0);
651
636 seq_puts(m, ",addr="); 652 seq_puts(m, ",addr=");
637 seq_escape(m, nfss->hostname, " \t\n\\"); 653 seq_escape(m, nfss->hostname, " \t\n\\");
654
655 return 0;
656}
657
658static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
659{
660 int i, cpu;
661 struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
662 struct rpc_auth *auth = nfss->client->cl_auth;
663 struct nfs_iostats totals = { };
664
665 seq_printf(m, "statvers=%s", NFS_IOSTAT_VERS);
666
667 /*
668 * Display all mount option settings
669 */
670 seq_printf(m, "\n\topts:\t");
671 seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw");
672 seq_puts(m, mnt->mnt_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : "");
673 seq_puts(m, mnt->mnt_sb->s_flags & MS_NOATIME ? ",noatime" : "");
674 seq_puts(m, mnt->mnt_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : "");
675 nfs_show_mount_options(m, nfss, 1);
676
677 seq_printf(m, "\n\tcaps:\t");
678 seq_printf(m, "caps=0x%x", nfss->caps);
679 seq_printf(m, ",wtmult=%d", nfss->wtmult);
680 seq_printf(m, ",dtsize=%d", nfss->dtsize);
681 seq_printf(m, ",bsize=%d", nfss->bsize);
682 seq_printf(m, ",namelen=%d", nfss->namelen);
683
684#ifdef CONFIG_NFS_V4
685 if (nfss->rpc_ops->version == 4) {
686 seq_printf(m, "\n\tnfsv4:\t");
687 seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]);
688 seq_printf(m, ",bm1=0x%x", nfss->attr_bitmask[1]);
689 seq_printf(m, ",acl=0x%x", nfss->acl_bitmask);
690 }
691#endif
692
693 /*
694 * Display security flavor in effect for this mount
695 */
696 seq_printf(m, "\n\tsec:\tflavor=%d", auth->au_ops->au_flavor);
697 if (auth->au_flavor)
698 seq_printf(m, ",pseudoflavor=%d", auth->au_flavor);
699
700 /*
701 * Display superblock I/O counters
702 */
703 for (cpu = 0; cpu < NR_CPUS; cpu++) {
704 struct nfs_iostats *stats;
705
706 if (!cpu_possible(cpu))
707 continue;
708
709 preempt_disable();
710 stats = per_cpu_ptr(nfss->io_stats, cpu);
711
712 for (i = 0; i < __NFSIOS_COUNTSMAX; i++)
713 totals.events[i] += stats->events[i];
714 for (i = 0; i < __NFSIOS_BYTESMAX; i++)
715 totals.bytes[i] += stats->bytes[i];
716
717 preempt_enable();
718 }
719
720 seq_printf(m, "\n\tevents:\t");
721 for (i = 0; i < __NFSIOS_COUNTSMAX; i++)
722 seq_printf(m, "%lu ", totals.events[i]);
723 seq_printf(m, "\n\tbytes:\t");
724 for (i = 0; i < __NFSIOS_BYTESMAX; i++)
725 seq_printf(m, "%Lu ", totals.bytes[i]);
726
638 return 0; 727 return 0;
639} 728}
640 729
@@ -1742,6 +1831,7 @@ static struct super_operations nfs4_sops = {
1742 .clear_inode = nfs4_clear_inode, 1831 .clear_inode = nfs4_clear_inode,
1743 .umount_begin = nfs_umount_begin, 1832 .umount_begin = nfs_umount_begin,
1744 .show_options = nfs_show_options, 1833 .show_options = nfs_show_options,
1834 .show_stats = nfs_show_stats,
1745}; 1835};
1746 1836
1747/* 1837/*
@@ -2015,6 +2105,7 @@ out_err:
2015out_free: 2105out_free:
2016 kfree(server->mnt_path); 2106 kfree(server->mnt_path);
2017 kfree(server->hostname); 2107 kfree(server->hostname);
2108 nfs_free_iostats(server->io_stats);
2018 kfree(server); 2109 kfree(server);
2019 return s; 2110 return s;
2020} 2111}