aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7f828a2cc858..eaa3b7b2f99e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -222,9 +222,7 @@ static struct kobj_type gfs2_ktype = {
222 .sysfs_ops = &gfs2_attr_ops, 222 .sysfs_ops = &gfs2_attr_ops,
223}; 223};
224 224
225static struct kset gfs2_kset = { 225static struct kset *gfs2_kset;
226 .ktype = &gfs2_ktype,
227};
228 226
229/* 227/*
230 * display struct lm_lockstruct fields 228 * display struct lm_lockstruct fields
@@ -492,14 +490,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
492{ 490{
493 int error; 491 int error;
494 492
495 sdp->sd_kobj.kset = &gfs2_kset; 493 sdp->sd_kobj.kset = gfs2_kset;
496 sdp->sd_kobj.ktype = &gfs2_ktype; 494 error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL,
497 495 "%s", sdp->sd_table_name);
498 error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name);
499 if (error)
500 goto fail;
501
502 error = kobject_register(&sdp->sd_kobj);
503 if (error) 496 if (error)
504 goto fail; 497 goto fail;
505 498
@@ -519,6 +512,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
519 if (error) 512 if (error)
520 goto fail_args; 513 goto fail_args;
521 514
515 kobject_uevent(&sdp->sd_kobj, KOBJ_ADD);
522 return 0; 516 return 0;
523 517
524fail_args: 518fail_args:
@@ -528,7 +522,7 @@ fail_counters:
528fail_lockstruct: 522fail_lockstruct:
529 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 523 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
530fail_reg: 524fail_reg:
531 kobject_unregister(&sdp->sd_kobj); 525 kobject_put(&sdp->sd_kobj);
532fail: 526fail:
533 fs_err(sdp, "error %d adding sysfs files", error); 527 fs_err(sdp, "error %d adding sysfs files", error);
534 return error; 528 return error;
@@ -540,21 +534,22 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
540 sysfs_remove_group(&sdp->sd_kobj, &args_group); 534 sysfs_remove_group(&sdp->sd_kobj, &args_group);
541 sysfs_remove_group(&sdp->sd_kobj, &counters_group); 535 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
542 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 536 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
543 kobject_unregister(&sdp->sd_kobj); 537 kobject_put(&sdp->sd_kobj);
544} 538}
545 539
546int gfs2_sys_init(void) 540int gfs2_sys_init(void)
547{ 541{
548 gfs2_sys_margs = NULL; 542 gfs2_sys_margs = NULL;
549 spin_lock_init(&gfs2_sys_margs_lock); 543 spin_lock_init(&gfs2_sys_margs_lock);
550 kobject_set_name(&gfs2_kset.kobj, "gfs2"); 544 gfs2_kset = kset_create_and_add("gfs2", NULL, fs_kobj);
551 kobj_set_kset_s(&gfs2_kset, fs_subsys); 545 if (!gfs2_kset)
552 return kset_register(&gfs2_kset); 546 return -ENOMEM;
547 return 0;
553} 548}
554 549
555void gfs2_sys_uninit(void) 550void gfs2_sys_uninit(void)
556{ 551{
557 kfree(gfs2_sys_margs); 552 kfree(gfs2_sys_margs);
558 kset_unregister(&gfs2_kset); 553 kset_unregister(gfs2_kset);
559} 554}
560 555