aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-08-13 07:18:08 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2009-08-17 06:11:18 -0400
commit31e54b01f3f00b595aac02e887960e5dcc575844 (patch)
tree61518f30980188ce060ae045b28f19a4022608c2 /fs
parent05164e5b37a8329bfbcf72f526302cb2dd885fbd (diff)
GFS2: Add sysfs link to device
This adds a link from the per-gfs2 sb sysfs directory to the block device upon which the filesystem is mounted. The link is called "device", strangely enough :-) Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/sys.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index dda4bf1e9eb4..0d4f7e974e9f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <linux/gfs2_ondisk.h> 18#include <linux/gfs2_ondisk.h>
19#include <linux/genhd.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
21#include "incore.h" 22#include "incore.h"
@@ -542,9 +543,17 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
542 if (error) 543 if (error)
543 goto fail_tune; 544 goto fail_tune;
544 545
546 error = sysfs_create_link(&sdp->sd_kobj,
547 &disk_to_dev(sb->s_bdev->bd_disk)->kobj,
548 "device");
549 if (error)
550 goto fail_lock_module;
551
545 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ADD, envp); 552 kobject_uevent_env(&sdp->sd_kobj, KOBJ_ADD, envp);
546 return 0; 553 return 0;
547 554
555fail_lock_module:
556 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group);
548fail_tune: 557fail_tune:
549 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 558 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
550fail_reg: 559fail_reg:
@@ -556,6 +565,7 @@ fail:
556 565
557void gfs2_sys_fs_del(struct gfs2_sbd *sdp) 566void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
558{ 567{
568 sysfs_remove_link(&sdp->sd_kobj, "device");
559 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 569 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
560 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group); 570 sysfs_remove_group(&sdp->sd_kobj, &lock_module_group);
561 kobject_put(&sdp->sd_kobj); 571 kobject_put(&sdp->sd_kobj);