aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-11-20 08:39:47 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2009-01-05 02:39:09 -0500
commit97cc1025b1a91c52e84f12478dcf0f853abc6564 (patch)
treecd71419049aeb13eea7012889d0ee0c715394e4d /fs/gfs2/sys.c
parent9ac1b4d9b6f885ccd7d8f56bceb609003a920ff7 (diff)
GFS2: Kill two daemons with one patch
This patch removes the two daemons, gfs2_scand and gfs2_glockd and replaces them with a shrinker which is called from the VM. The net result is that GFS2 responds better when there is memory pressure, since it shrinks the glock cache at the same rate as the VFS shrinks the dcache and icache. There are no longer any time based criteria for shrinking glocks, they are kept until such time as the VM asks for more memory and then we demote just as many glocks as required. There are potential future changes to this code, including the possibility of sorting the glocks which are to be written back into inode number order, to get a better I/O ordering. It would be very useful to have an elevator based workqueue implementation for this, as that would automatically deal with the read I/O cases at the same time. This patch is my answer to Andrew Morton's remark, made during the initial review of GFS2, asking why GFS2 needs so many kernel threads, the answer being that it doesn't :-) This patch is a net loss of about 200 lines of code. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 59e36fd80903..67ba5b7b759b 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -263,7 +263,6 @@ ARGS_ATTR(localcaching, "%d\n");
263ARGS_ATTR(localflocks, "%d\n"); 263ARGS_ATTR(localflocks, "%d\n");
264ARGS_ATTR(debug, "%d\n"); 264ARGS_ATTR(debug, "%d\n");
265ARGS_ATTR(upgrade, "%d\n"); 265ARGS_ATTR(upgrade, "%d\n");
266ARGS_ATTR(num_glockd, "%u\n");
267ARGS_ATTR(posix_acl, "%d\n"); 266ARGS_ATTR(posix_acl, "%d\n");
268ARGS_ATTR(quota, "%u\n"); 267ARGS_ATTR(quota, "%u\n");
269ARGS_ATTR(suiddir, "%d\n"); 268ARGS_ATTR(suiddir, "%d\n");
@@ -279,7 +278,6 @@ static struct attribute *args_attrs[] = {
279 &args_attr_localflocks.attr, 278 &args_attr_localflocks.attr,
280 &args_attr_debug.attr, 279 &args_attr_debug.attr,
281 &args_attr_upgrade.attr, 280 &args_attr_upgrade.attr,
282 &args_attr_num_glockd.attr,
283 &args_attr_posix_acl.attr, 281 &args_attr_posix_acl.attr,
284 &args_attr_quota.attr, 282 &args_attr_quota.attr,
285 &args_attr_suiddir.attr, 283 &args_attr_suiddir.attr,
@@ -288,30 +286,6 @@ static struct attribute *args_attrs[] = {
288}; 286};
289 287
290/* 288/*
291 * display counters from superblock
292 */
293
294struct counters_attr {
295 struct attribute attr;
296 ssize_t (*show)(struct gfs2_sbd *, char *);
297};
298
299#define COUNTERS_ATTR(name, fmt) \
300static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
301{ \
302 return snprintf(buf, PAGE_SIZE, fmt, \
303 (unsigned int)atomic_read(&sdp->sd_##name)); \
304} \
305static struct counters_attr counters_attr_##name = __ATTR_RO(name)
306
307COUNTERS_ATTR(reclaimed, "%u\n");
308
309static struct attribute *counters_attrs[] = {
310 &counters_attr_reclaimed.attr,
311 NULL,
312};
313
314/*
315 * get and set struct gfs2_tune fields 289 * get and set struct gfs2_tune fields
316 */ 290 */
317 291
@@ -393,7 +367,6 @@ static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
393} \ 367} \
394TUNE_ATTR_2(name, name##_store) 368TUNE_ATTR_2(name, name##_store)
395 369
396TUNE_ATTR(demote_secs, 0);
397TUNE_ATTR(incore_log_blocks, 0); 370TUNE_ATTR(incore_log_blocks, 0);
398TUNE_ATTR(log_flush_secs, 0); 371TUNE_ATTR(log_flush_secs, 0);
399TUNE_ATTR(quota_warn_period, 0); 372TUNE_ATTR(quota_warn_period, 0);
@@ -411,7 +384,6 @@ TUNE_ATTR_DAEMON(logd_secs, logd_process);
411TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); 384TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store);
412 385
413static struct attribute *tune_attrs[] = { 386static struct attribute *tune_attrs[] = {
414 &tune_attr_demote_secs.attr,
415 &tune_attr_incore_log_blocks.attr, 387 &tune_attr_incore_log_blocks.attr,
416 &tune_attr_log_flush_secs.attr, 388 &tune_attr_log_flush_secs.attr,
417 &tune_attr_quota_warn_period.attr, 389 &tune_attr_quota_warn_period.attr,
@@ -435,11 +407,6 @@ static struct attribute_group lockstruct_group = {
435 .attrs = lockstruct_attrs, 407 .attrs = lockstruct_attrs,
436}; 408};
437 409
438static struct attribute_group counters_group = {
439 .name = "counters",
440 .attrs = counters_attrs,
441};
442
443static struct attribute_group args_group = { 410static struct attribute_group args_group = {
444 .name = "args", 411 .name = "args",
445 .attrs = args_attrs, 412 .attrs = args_attrs,
@@ -464,13 +431,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
464 if (error) 431 if (error)
465 goto fail_reg; 432 goto fail_reg;
466 433
467 error = sysfs_create_group(&sdp->sd_kobj, &counters_group);
468 if (error)
469 goto fail_lockstruct;
470
471 error = sysfs_create_group(&sdp->sd_kobj, &args_group); 434 error = sysfs_create_group(&sdp->sd_kobj, &args_group);
472 if (error) 435 if (error)
473 goto fail_counters; 436 goto fail_lockstruct;
474 437
475 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); 438 error = sysfs_create_group(&sdp->sd_kobj, &tune_group);
476 if (error) 439 if (error)
@@ -481,8 +444,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
481 444
482fail_args: 445fail_args:
483 sysfs_remove_group(&sdp->sd_kobj, &args_group); 446 sysfs_remove_group(&sdp->sd_kobj, &args_group);
484fail_counters:
485 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
486fail_lockstruct: 447fail_lockstruct:
487 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 448 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
488fail_reg: 449fail_reg:
@@ -496,7 +457,6 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
496{ 457{
497 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 458 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
498 sysfs_remove_group(&sdp->sd_kobj, &args_group); 459 sysfs_remove_group(&sdp->sd_kobj, &args_group);
499 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
500 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 460 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
501 kobject_put(&sdp->sd_kobj); 461 kobject_put(&sdp->sd_kobj);
502} 462}