Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
4ce3121f NS |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
1da177e4 | 4 | * |
4ce3121f NS |
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 | |
1da177e4 LT |
7 | * published by the Free Software Foundation. |
8 | * | |
4ce3121f NS |
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. | |
1da177e4 | 13 | * |
4ce3121f NS |
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 | |
1da177e4 | 17 | */ |
1da177e4 LT |
18 | #include "xfs.h" |
19 | #include "xfs_fs.h" | |
a844f451 | 20 | #include "xfs_bit.h" |
1da177e4 | 21 | #include "xfs_log.h" |
a844f451 | 22 | #include "xfs_inum.h" |
1da177e4 LT |
23 | #include "xfs_trans.h" |
24 | #include "xfs_sb.h" | |
a844f451 | 25 | #include "xfs_ag.h" |
1da177e4 | 26 | #include "xfs_alloc.h" |
1da177e4 LT |
27 | #include "xfs_quota.h" |
28 | #include "xfs_mount.h" | |
1da177e4 | 29 | #include "xfs_bmap_btree.h" |
1da177e4 | 30 | #include "xfs_inode.h" |
a844f451 | 31 | #include "xfs_itable.h" |
1da177e4 | 32 | #include "xfs_bmap.h" |
1da177e4 LT |
33 | #include "xfs_rtalloc.h" |
34 | #include "xfs_error.h" | |
1da177e4 LT |
35 | #include "xfs_attr.h" |
36 | #include "xfs_buf_item.h" | |
1da177e4 LT |
37 | #include "xfs_qm.h" |
38 | ||
39 | struct xqmstats xqmstats; | |
40 | ||
361735fd | 41 | static int xqm_proc_show(struct seq_file *m, void *v) |
1da177e4 | 42 | { |
1da177e4 | 43 | /* maximum; incore; ratio free to inuse; freelist */ |
361735fd | 44 | seq_printf(m, "%d\t%d\t%d\t%u\n", |
1da177e4 LT |
45 | ndquot, |
46 | xfs_Gqm? atomic_read(&xfs_Gqm->qm_totaldquots) : 0, | |
47 | xfs_Gqm? xfs_Gqm->qm_dqfree_ratio : 0, | |
3a8406f6 | 48 | xfs_Gqm? xfs_Gqm->qm_dqfrlist_cnt : 0); |
361735fd | 49 | return 0; |
1da177e4 LT |
50 | } |
51 | ||
361735fd | 52 | static int xqm_proc_open(struct inode *inode, struct file *file) |
1da177e4 | 53 | { |
361735fd AD |
54 | return single_open(file, xqm_proc_show, NULL); |
55 | } | |
56 | ||
57 | static const struct file_operations xqm_proc_fops = { | |
58 | .owner = THIS_MODULE, | |
59 | .open = xqm_proc_open, | |
60 | .read = seq_read, | |
61 | .llseek = seq_lseek, | |
62 | .release = single_release, | |
63 | }; | |
1da177e4 | 64 | |
361735fd AD |
65 | static int xqmstat_proc_show(struct seq_file *m, void *v) |
66 | { | |
1da177e4 | 67 | /* quota performance statistics */ |
361735fd | 68 | seq_printf(m, "qm %u %u %u %u %u %u %u %u\n", |
1da177e4 LT |
69 | xqmstats.xs_qm_dqreclaims, |
70 | xqmstats.xs_qm_dqreclaim_misses, | |
71 | xqmstats.xs_qm_dquot_dups, | |
72 | xqmstats.xs_qm_dqcachemisses, | |
73 | xqmstats.xs_qm_dqcachehits, | |
74 | xqmstats.xs_qm_dqwants, | |
75 | xqmstats.xs_qm_dqshake_reclaims, | |
76 | xqmstats.xs_qm_dqinact_reclaims); | |
361735fd AD |
77 | return 0; |
78 | } | |
1da177e4 | 79 | |
361735fd AD |
80 | static int xqmstat_proc_open(struct inode *inode, struct file *file) |
81 | { | |
82 | return single_open(file, xqmstat_proc_show, NULL); | |
1da177e4 LT |
83 | } |
84 | ||
361735fd AD |
85 | static const struct file_operations xqmstat_proc_fops = { |
86 | .owner = THIS_MODULE, | |
87 | .open = xqmstat_proc_open, | |
88 | .read = seq_read, | |
89 | .llseek = seq_lseek, | |
90 | .release = single_release, | |
91 | }; | |
92 | ||
1da177e4 LT |
93 | void |
94 | xfs_qm_init_procfs(void) | |
95 | { | |
361735fd AD |
96 | proc_create("fs/xfs/xqmstat", 0, NULL, &xqmstat_proc_fops); |
97 | proc_create("fs/xfs/xqm", 0, NULL, &xqm_proc_fops); | |
1da177e4 LT |
98 | } |
99 | ||
100 | void | |
101 | xfs_qm_cleanup_procfs(void) | |
102 | { | |
103 | remove_proc_entry("fs/xfs/xqm", NULL); | |
104 | remove_proc_entry("fs/xfs/xqmstat", NULL); | |
105 | } |