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.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 9f6d48b75fd..94bd59ec54e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -276,25 +276,6 @@ static struct kobj_type gfs2_ktype = {
276 .sysfs_ops = &gfs2_attr_ops, 276 .sysfs_ops = &gfs2_attr_ops,
277}; 277};
278 278
279/*
280 * display struct lm_lockstruct fields
281 */
282
283#define LOCKSTRUCT_ATTR(name, fmt) \
284static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
285{ \
286 return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_lockstruct.ls_##name); \
287} \
288static struct gfs2_attr lockstruct_attr_##name = __ATTR_RO(name)
289
290LOCKSTRUCT_ATTR(jid, "%u\n");
291LOCKSTRUCT_ATTR(first, "%u\n");
292
293static struct attribute *lockstruct_attrs[] = {
294 &lockstruct_attr_jid.attr,
295 &lockstruct_attr_first.attr,
296 NULL,
297};
298 279
299/* 280/*
300 * lock_module. Originally from lock_dlm 281 * lock_module. Originally from lock_dlm
@@ -397,6 +378,11 @@ static ssize_t recover_status_show(struct gfs2_sbd *sdp, char *buf)
397 return sprintf(buf, "%d\n", ls->ls_recover_jid_status); 378 return sprintf(buf, "%d\n", ls->ls_recover_jid_status);
398} 379}
399 380
381static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf)
382{
383 return sprintf(buf, "%u\n", sdp->sd_lockstruct.ls_jid);
384}
385
400#define GDLM_ATTR(_name,_mode,_show,_store) \ 386#define GDLM_ATTR(_name,_mode,_show,_store) \
401static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) 387static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store)
402 388
@@ -404,6 +390,7 @@ GDLM_ATTR(proto_name, 0444, proto_name_show, NULL);
404GDLM_ATTR(block, 0644, block_show, block_store); 390GDLM_ATTR(block, 0644, block_show, block_store);
405GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); 391GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store);
406GDLM_ATTR(id, 0444, lkid_show, NULL); 392GDLM_ATTR(id, 0444, lkid_show, NULL);
393GDLM_ATTR(jid, 0444, jid_show, NULL);
407GDLM_ATTR(first, 0444, lkfirst_show, NULL); 394GDLM_ATTR(first, 0444, lkfirst_show, NULL);
408GDLM_ATTR(first_done, 0444, first_done_show, NULL); 395GDLM_ATTR(first_done, 0444, first_done_show, NULL);
409GDLM_ATTR(recover, 0200, NULL, recover_store); 396GDLM_ATTR(recover, 0200, NULL, recover_store);
@@ -415,7 +402,7 @@ static struct attribute *lock_module_attrs[] = {
415 &gdlm_attr_block.attr, 402 &gdlm_attr_block.attr,
416 &gdlm_attr_withdraw.attr, 403 &gdlm_attr_withdraw.attr,
417 &gdlm_attr_id.attr, 404 &gdlm_attr_id.attr,
418 &lockstruct_attr_jid.attr, 405 &gdlm_attr_jid.attr,
419 &gdlm_attr_first.attr, 406 &gdlm_attr_first.attr,
420 &gdlm_attr_first_done.attr, 407 &gdlm_attr_first_done.attr,
421 &gdlm_attr_recover.attr, 408 &gdlm_attr_recover.attr,
@@ -558,11 +545,6 @@ static struct attribute *tune_attrs[] = {
558 NULL, 545 NULL,
559}; 546};
560 547
561static struct attribute_group lockstruct_group = {
562 .name = "lockstruct",
563 .attrs = lockstruct_attrs,
564};
565
566static struct attribute_group args_group = { 548static struct attribute_group args_group = {
567 .name = "args", 549 .name = "args",
568 .attrs = args_attrs, 550 .attrs = args_attrs,
@@ -588,13 +570,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
588 if (error) 570 if (error)
589 goto fail; 571 goto fail;
590 572
591 error = sysfs_create_group(&sdp->sd_kobj, &lockstruct_group);
592 if (error)
593 goto fail_reg;
594
595 error = sysfs_create_group(&sdp->sd_kobj, &args_group); 573 error = sysfs_create_group(&sdp->sd_kobj, &args_group);
596 if (error) 574 if (error)
597 goto fail_lockstruct; 575 goto fail_reg;
598 576
599 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); 577 error = sysfs_create_group(&sdp->sd_kobj, &tune_group);
600 if (error) 578 if (error)
@@ -611,8 +589,6 @@ fail_tune:
611 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 589 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
612fail_args: 590fail_args:
613 sysfs_remove_group(&sdp->sd_kobj, &args_group); 591 sysfs_remove_group(&sdp->sd_kobj, &args_group);
614fail_lockstruct:
615 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
616fail_reg: 592fail_reg:
617 kobject_put(&sdp->sd_kobj); 593 kobject_put(&sdp->sd_kobj);
618fail: 594fail:
@@ -624,7 +600,6 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
624{ 600{
625 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 601 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
626 sysfs_remove_group(&sdp->sd_kobj, &args_group); 602 sysfs_remove_group(&sdp->sd_kobj, &args_group);
627 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
628 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); 603 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group);
629 kobject_put(&sdp->sd_kobj); 604 kobject_put(&sdp->sd_kobj);
630} 605}