2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
34 #include <linux/proc_fs.h>
36 struct xfsstats xfsstats;
48 static struct xstats_entry {
52 { "extent_alloc", XFSSTAT_END_EXTENT_ALLOC },
53 { "abt", XFSSTAT_END_ALLOC_BTREE },
54 { "blk_map", XFSSTAT_END_BLOCK_MAPPING },
55 { "bmbt", XFSSTAT_END_BLOCK_MAP_BTREE },
56 { "dir", XFSSTAT_END_DIRECTORY_OPS },
57 { "trans", XFSSTAT_END_TRANSACTIONS },
58 { "ig", XFSSTAT_END_INODE_OPS },
59 { "log", XFSSTAT_END_LOG_OPS },
60 { "push_ail", XFSSTAT_END_TAIL_PUSHING },
61 { "xstrat", XFSSTAT_END_WRITE_CONVERT },
62 { "rw", XFSSTAT_END_READ_WRITE_OPS },
63 { "attr", XFSSTAT_END_ATTRIBUTE_OPS },
64 { "icluster", XFSSTAT_END_INODE_CLUSTER },
65 { "vnodes", XFSSTAT_END_VNODE_OPS },
66 { "buf", XFSSTAT_END_BUF },
69 for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) {
70 len += sprintf(buffer + len, xstats[i].desc);
71 /* inner loop does each group */
72 while (j < xstats[i].endpoint) {
73 len += sprintf(buffer + len, " %u",
74 *(((__u32*)&xfsstats) + j));
79 /* extra precision counters */
80 len += sprintf(buffer + len, "xpc %Lu %Lu %Lu\n",
81 xfsstats.xs_xstrat_bytes,
82 xfsstats.xs_write_bytes,
83 xfsstats.xs_read_bytes);
84 len += sprintf(buffer + len, "debug %u\n",
96 *start = buffer + offset;
97 if ((len -= offset) > count)
105 xfs_init_procfs(void)
107 if (!proc_mkdir("fs/xfs", 0))
109 create_proc_read_entry("fs/xfs/stat", 0, 0, xfs_read_xfsstats, NULL);
113 xfs_cleanup_procfs(void)
115 remove_proc_entry("fs/xfs/stat", NULL);
116 remove_proc_entry("fs/xfs", NULL);