2 * Copyright (c) 2001-2004 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 "xfs_refcache.h"
35 #include <linux/sysctl.h>
36 #include <linux/proc_fs.h>
39 static struct ctl_table_header *xfs_table_header;
42 /* Custom proc handlers */
45 xfs_refcache_resize_proc_handler(
52 int ret, *valp = ctl->data;
53 int xfs_refcache_new_size;
54 int xfs_refcache_old_size = *valp;
56 ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
57 xfs_refcache_new_size = *valp;
59 if (!ret && write && xfs_refcache_new_size != xfs_refcache_old_size) {
60 xfs_refcache_resize(xfs_refcache_new_size);
61 /* Don't purge more than size of the cache */
62 if (xfs_refcache_new_size < xfs_refcache_purge_count)
63 xfs_refcache_purge_count = xfs_refcache_new_size;
71 xfs_stats_clear_proc_handler(
78 int ret, *valp = ctl->data;
81 ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
83 if (!ret && write && *valp) {
84 printk("XFS Clearing xfsstats\n");
85 /* save vn_active, it's a universal truth! */
86 vn_active = xfsstats.vn_active;
87 memset(&xfsstats, 0, sizeof(xfsstats));
88 xfsstats.vn_active = vn_active;
94 #endif /* CONFIG_PROC_FS */
96 STATIC ctl_table xfs_table[] = {
97 {XFS_REFCACHE_SIZE, "refcache_size", &xfs_params.refcache_size.val,
98 sizeof(int), 0644, NULL, &xfs_refcache_resize_proc_handler,
100 &xfs_params.refcache_size.min, &xfs_params.refcache_size.max},
102 /* Note, the max here is different, it is the current refcache size */
103 {XFS_REFCACHE_PURGE, "refcache_purge", &xfs_params.refcache_purge.val,
104 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
105 &sysctl_intvec, NULL,
106 &xfs_params.refcache_purge.min, &xfs_params.refcache_size.val},
108 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
109 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
110 &sysctl_intvec, NULL,
111 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
113 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
114 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
115 &sysctl_intvec, NULL,
116 &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
118 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
119 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
120 &sysctl_intvec, NULL,
121 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
123 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
124 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
125 &sysctl_intvec, NULL,
126 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
128 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
129 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
130 &sysctl_intvec, NULL,
131 &xfs_params.error_level.min, &xfs_params.error_level.max},
133 {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
134 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
135 &sysctl_intvec, NULL,
136 &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
138 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
139 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
140 &sysctl_intvec, NULL,
141 &xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
143 {XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
144 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
145 &sysctl_intvec, NULL,
146 &xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
148 {XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
149 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
150 &sysctl_intvec, NULL,
151 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
153 {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
154 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
155 &sysctl_intvec, NULL,
156 &xfs_params.xfs_buf_timer.min, &xfs_params.xfs_buf_timer.max},
158 {XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
159 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
160 &sysctl_intvec, NULL,
161 &xfs_params.xfs_buf_age.min, &xfs_params.xfs_buf_age.max},
163 {XFS_INHERIT_NOSYM, "inherit_nosymlinks", &xfs_params.inherit_nosym.val,
164 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
165 &sysctl_intvec, NULL,
166 &xfs_params.inherit_nosym.min, &xfs_params.inherit_nosym.max},
168 {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
169 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
170 &sysctl_intvec, NULL,
171 &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
173 /* please keep this the last entry */
174 #ifdef CONFIG_PROC_FS
175 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
176 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
177 &sysctl_intvec, NULL,
178 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
179 #endif /* CONFIG_PROC_FS */
184 STATIC ctl_table xfs_dir_table[] = {
185 {FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
189 STATIC ctl_table xfs_root_table[] = {
190 {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table},
195 xfs_sysctl_register(void)
197 xfs_table_header = register_sysctl_table(xfs_root_table, 1);
201 xfs_sysctl_unregister(void)
203 if (xfs_table_header)
204 unregister_sysctl_table(xfs_table_header);