Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[deliverable/linux.git] / fs / xfs / quota / xfs_qm_stats.c
1 /*
2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #include "xfs.h"
19 #include "xfs_fs.h"
20 #include "xfs_bit.h"
21 #include "xfs_log.h"
22 #include "xfs_inum.h"
23 #include "xfs_trans.h"
24 #include "xfs_sb.h"
25 #include "xfs_ag.h"
26 #include "xfs_dir2.h"
27 #include "xfs_alloc.h"
28 #include "xfs_dmapi.h"
29 #include "xfs_quota.h"
30 #include "xfs_mount.h"
31 #include "xfs_bmap_btree.h"
32 #include "xfs_alloc_btree.h"
33 #include "xfs_ialloc_btree.h"
34 #include "xfs_dir2_sf.h"
35 #include "xfs_attr_sf.h"
36 #include "xfs_dinode.h"
37 #include "xfs_inode.h"
38 #include "xfs_ialloc.h"
39 #include "xfs_itable.h"
40 #include "xfs_bmap.h"
41 #include "xfs_btree.h"
42 #include "xfs_rtalloc.h"
43 #include "xfs_error.h"
44 #include "xfs_rw.h"
45 #include "xfs_attr.h"
46 #include "xfs_buf_item.h"
47 #include "xfs_qm.h"
48
49 struct xqmstats xqmstats;
50
51 static int xqm_proc_show(struct seq_file *m, void *v)
52 {
53 /* maximum; incore; ratio free to inuse; freelist */
54 seq_printf(m, "%d\t%d\t%d\t%u\n",
55 ndquot,
56 xfs_Gqm? atomic_read(&xfs_Gqm->qm_totaldquots) : 0,
57 xfs_Gqm? xfs_Gqm->qm_dqfree_ratio : 0,
58 xfs_Gqm? xfs_Gqm->qm_dqfreelist.qh_nelems : 0);
59 return 0;
60 }
61
62 static int xqm_proc_open(struct inode *inode, struct file *file)
63 {
64 return single_open(file, xqm_proc_show, NULL);
65 }
66
67 static const struct file_operations xqm_proc_fops = {
68 .owner = THIS_MODULE,
69 .open = xqm_proc_open,
70 .read = seq_read,
71 .llseek = seq_lseek,
72 .release = single_release,
73 };
74
75 static int xqmstat_proc_show(struct seq_file *m, void *v)
76 {
77 /* quota performance statistics */
78 seq_printf(m, "qm %u %u %u %u %u %u %u %u\n",
79 xqmstats.xs_qm_dqreclaims,
80 xqmstats.xs_qm_dqreclaim_misses,
81 xqmstats.xs_qm_dquot_dups,
82 xqmstats.xs_qm_dqcachemisses,
83 xqmstats.xs_qm_dqcachehits,
84 xqmstats.xs_qm_dqwants,
85 xqmstats.xs_qm_dqshake_reclaims,
86 xqmstats.xs_qm_dqinact_reclaims);
87 return 0;
88 }
89
90 static int xqmstat_proc_open(struct inode *inode, struct file *file)
91 {
92 return single_open(file, xqmstat_proc_show, NULL);
93 }
94
95 static const struct file_operations xqmstat_proc_fops = {
96 .owner = THIS_MODULE,
97 .open = xqmstat_proc_open,
98 .read = seq_read,
99 .llseek = seq_lseek,
100 .release = single_release,
101 };
102
103 void
104 xfs_qm_init_procfs(void)
105 {
106 proc_create("fs/xfs/xqmstat", 0, NULL, &xqmstat_proc_fops);
107 proc_create("fs/xfs/xqm", 0, NULL, &xqm_proc_fops);
108 }
109
110 void
111 xfs_qm_cleanup_procfs(void)
112 {
113 remove_proc_entry("fs/xfs/xqm", NULL);
114 remove_proc_entry("fs/xfs/xqmstat", NULL);
115 }
This page took 0.034591 seconds and 5 git commands to generate.