diff options
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r-- | fs/gfs2/sys.c | 66 |
1 files changed, 16 insertions, 50 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 7e1879f1a02c..26c1fa777a95 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -26,9 +26,6 @@ | |||
26 | #include "quota.h" | 26 | #include "quota.h" |
27 | #include "util.h" | 27 | #include "util.h" |
28 | 28 | ||
29 | char *gfs2_sys_margs; | ||
30 | spinlock_t gfs2_sys_margs_lock; | ||
31 | |||
32 | static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) | 29 | static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) |
33 | { | 30 | { |
34 | return snprintf(buf, PAGE_SIZE, "%u:%u\n", | 31 | return snprintf(buf, PAGE_SIZE, "%u:%u\n", |
@@ -263,7 +260,6 @@ ARGS_ATTR(localcaching, "%d\n"); | |||
263 | ARGS_ATTR(localflocks, "%d\n"); | 260 | ARGS_ATTR(localflocks, "%d\n"); |
264 | ARGS_ATTR(debug, "%d\n"); | 261 | ARGS_ATTR(debug, "%d\n"); |
265 | ARGS_ATTR(upgrade, "%d\n"); | 262 | ARGS_ATTR(upgrade, "%d\n"); |
266 | ARGS_ATTR(num_glockd, "%u\n"); | ||
267 | ARGS_ATTR(posix_acl, "%d\n"); | 263 | ARGS_ATTR(posix_acl, "%d\n"); |
268 | ARGS_ATTR(quota, "%u\n"); | 264 | ARGS_ATTR(quota, "%u\n"); |
269 | ARGS_ATTR(suiddir, "%d\n"); | 265 | ARGS_ATTR(suiddir, "%d\n"); |
@@ -279,7 +275,6 @@ static struct attribute *args_attrs[] = { | |||
279 | &args_attr_localflocks.attr, | 275 | &args_attr_localflocks.attr, |
280 | &args_attr_debug.attr, | 276 | &args_attr_debug.attr, |
281 | &args_attr_upgrade.attr, | 277 | &args_attr_upgrade.attr, |
282 | &args_attr_num_glockd.attr, | ||
283 | &args_attr_posix_acl.attr, | 278 | &args_attr_posix_acl.attr, |
284 | &args_attr_quota.attr, | 279 | &args_attr_quota.attr, |
285 | &args_attr_suiddir.attr, | 280 | &args_attr_suiddir.attr, |
@@ -288,30 +283,6 @@ static struct attribute *args_attrs[] = { | |||
288 | }; | 283 | }; |
289 | 284 | ||
290 | /* | 285 | /* |
291 | * display counters from superblock | ||
292 | */ | ||
293 | |||
294 | struct counters_attr { | ||
295 | struct attribute attr; | ||
296 | ssize_t (*show)(struct gfs2_sbd *, char *); | ||
297 | }; | ||
298 | |||
299 | #define COUNTERS_ATTR(name, fmt) \ | ||
300 | static 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 | } \ | ||
305 | static struct counters_attr counters_attr_##name = __ATTR_RO(name) | ||
306 | |||
307 | COUNTERS_ATTR(reclaimed, "%u\n"); | ||
308 | |||
309 | static struct attribute *counters_attrs[] = { | ||
310 | &counters_attr_reclaimed.attr, | ||
311 | NULL, | ||
312 | }; | ||
313 | |||
314 | /* | ||
315 | * get and set struct gfs2_tune fields | 286 | * get and set struct gfs2_tune fields |
316 | */ | 287 | */ |
317 | 288 | ||
@@ -393,7 +364,6 @@ static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\ | |||
393 | } \ | 364 | } \ |
394 | TUNE_ATTR_2(name, name##_store) | 365 | TUNE_ATTR_2(name, name##_store) |
395 | 366 | ||
396 | TUNE_ATTR(demote_secs, 0); | ||
397 | TUNE_ATTR(incore_log_blocks, 0); | 367 | TUNE_ATTR(incore_log_blocks, 0); |
398 | TUNE_ATTR(log_flush_secs, 0); | 368 | TUNE_ATTR(log_flush_secs, 0); |
399 | TUNE_ATTR(quota_warn_period, 0); | 369 | TUNE_ATTR(quota_warn_period, 0); |
@@ -408,11 +378,9 @@ TUNE_ATTR(stall_secs, 1); | |||
408 | TUNE_ATTR(statfs_quantum, 1); | 378 | TUNE_ATTR(statfs_quantum, 1); |
409 | TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); | 379 | TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); |
410 | TUNE_ATTR_DAEMON(logd_secs, logd_process); | 380 | TUNE_ATTR_DAEMON(logd_secs, logd_process); |
411 | TUNE_ATTR_DAEMON(quotad_secs, quotad_process); | ||
412 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); | 381 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); |
413 | 382 | ||
414 | static struct attribute *tune_attrs[] = { | 383 | static struct attribute *tune_attrs[] = { |
415 | &tune_attr_demote_secs.attr, | ||
416 | &tune_attr_incore_log_blocks.attr, | 384 | &tune_attr_incore_log_blocks.attr, |
417 | &tune_attr_log_flush_secs.attr, | 385 | &tune_attr_log_flush_secs.attr, |
418 | &tune_attr_quota_warn_period.attr, | 386 | &tune_attr_quota_warn_period.attr, |
@@ -426,7 +394,6 @@ static struct attribute *tune_attrs[] = { | |||
426 | &tune_attr_statfs_quantum.attr, | 394 | &tune_attr_statfs_quantum.attr, |
427 | &tune_attr_recoverd_secs.attr, | 395 | &tune_attr_recoverd_secs.attr, |
428 | &tune_attr_logd_secs.attr, | 396 | &tune_attr_logd_secs.attr, |
429 | &tune_attr_quotad_secs.attr, | ||
430 | &tune_attr_quota_scale.attr, | 397 | &tune_attr_quota_scale.attr, |
431 | &tune_attr_new_files_jdata.attr, | 398 | &tune_attr_new_files_jdata.attr, |
432 | NULL, | 399 | NULL, |
@@ -437,11 +404,6 @@ static struct attribute_group lockstruct_group = { | |||
437 | .attrs = lockstruct_attrs, | 404 | .attrs = lockstruct_attrs, |
438 | }; | 405 | }; |
439 | 406 | ||
440 | static struct attribute_group counters_group = { | ||
441 | .name = "counters", | ||
442 | .attrs = counters_attrs, | ||
443 | }; | ||
444 | |||
445 | static struct attribute_group args_group = { | 407 | static struct attribute_group args_group = { |
446 | .name = "args", | 408 | .name = "args", |
447 | .attrs = args_attrs, | 409 | .attrs = args_attrs, |
@@ -466,13 +428,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
466 | if (error) | 428 | if (error) |
467 | goto fail_reg; | 429 | goto fail_reg; |
468 | 430 | ||
469 | error = sysfs_create_group(&sdp->sd_kobj, &counters_group); | ||
470 | if (error) | ||
471 | goto fail_lockstruct; | ||
472 | |||
473 | error = sysfs_create_group(&sdp->sd_kobj, &args_group); | 431 | error = sysfs_create_group(&sdp->sd_kobj, &args_group); |
474 | if (error) | 432 | if (error) |
475 | goto fail_counters; | 433 | goto fail_lockstruct; |
476 | 434 | ||
477 | error = sysfs_create_group(&sdp->sd_kobj, &tune_group); | 435 | error = sysfs_create_group(&sdp->sd_kobj, &tune_group); |
478 | if (error) | 436 | if (error) |
@@ -483,8 +441,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
483 | 441 | ||
484 | fail_args: | 442 | fail_args: |
485 | sysfs_remove_group(&sdp->sd_kobj, &args_group); | 443 | sysfs_remove_group(&sdp->sd_kobj, &args_group); |
486 | fail_counters: | ||
487 | sysfs_remove_group(&sdp->sd_kobj, &counters_group); | ||
488 | fail_lockstruct: | 444 | fail_lockstruct: |
489 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); | 445 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); |
490 | fail_reg: | 446 | fail_reg: |
@@ -498,16 +454,27 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp) | |||
498 | { | 454 | { |
499 | sysfs_remove_group(&sdp->sd_kobj, &tune_group); | 455 | sysfs_remove_group(&sdp->sd_kobj, &tune_group); |
500 | sysfs_remove_group(&sdp->sd_kobj, &args_group); | 456 | sysfs_remove_group(&sdp->sd_kobj, &args_group); |
501 | sysfs_remove_group(&sdp->sd_kobj, &counters_group); | ||
502 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); | 457 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); |
503 | kobject_put(&sdp->sd_kobj); | 458 | kobject_put(&sdp->sd_kobj); |
504 | } | 459 | } |
505 | 460 | ||
461 | static int gfs2_uevent(struct kset *kset, struct kobject *kobj, | ||
462 | struct kobj_uevent_env *env) | ||
463 | { | ||
464 | struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); | ||
465 | add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); | ||
466 | add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); | ||
467 | return 0; | ||
468 | } | ||
469 | |||
470 | static struct kset_uevent_ops gfs2_uevent_ops = { | ||
471 | .uevent = gfs2_uevent, | ||
472 | }; | ||
473 | |||
474 | |||
506 | int gfs2_sys_init(void) | 475 | int gfs2_sys_init(void) |
507 | { | 476 | { |
508 | gfs2_sys_margs = NULL; | 477 | gfs2_kset = kset_create_and_add("gfs2", &gfs2_uevent_ops, fs_kobj); |
509 | spin_lock_init(&gfs2_sys_margs_lock); | ||
510 | gfs2_kset = kset_create_and_add("gfs2", NULL, fs_kobj); | ||
511 | if (!gfs2_kset) | 478 | if (!gfs2_kset) |
512 | return -ENOMEM; | 479 | return -ENOMEM; |
513 | return 0; | 480 | return 0; |
@@ -515,7 +482,6 @@ int gfs2_sys_init(void) | |||
515 | 482 | ||
516 | void gfs2_sys_uninit(void) | 483 | void gfs2_sys_uninit(void) |
517 | { | 484 | { |
518 | kfree(gfs2_sys_margs); | ||
519 | kset_unregister(gfs2_kset); | 485 | kset_unregister(gfs2_kset); |
520 | } | 486 | } |
521 | 487 | ||