From: Jun'ichi Nomura Date: Mon, 27 Mar 2006 09:17:58 +0000 (-0800) Subject: [PATCH] dm/md dependency tree in sysfs: md to use bd_claim_by_disk X-Git-Tag: v2.6.17-rc1~301 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=5463c7904c952aa6b6804dd902c72a5332fa5221;p=linux-2.6-omap-h63xx.git [PATCH] dm/md dependency tree in sysfs: md to use bd_claim_by_disk Use bd_claim_by_disk. Following symlinks are created if md0 is built from sda and sdb /sys/block/md0/slaves/sda --> /sys/block/sda /sys/block/md0/slaves/sdb --> /sys/block/sdb /sys/block/sda/holders/md0 --> /sys/block/md0 /sys/block/sdb/holders/md0 --> /sys/block/md0 Signed-off-by: Jun'ichi Nomura Cc: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 5ed2228745c..bde3e968225 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1301,6 +1301,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) else ko = &rdev->bdev->bd_disk->kobj; sysfs_create_link(&rdev->kobj, ko, "block"); + bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); return 0; } @@ -1311,6 +1312,7 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) MD_BUG(); return; } + bd_release_from_disk(rdev->bdev, rdev->mddev->gendisk); list_del_init(&rdev->same_set); printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); rdev->mddev = NULL;