[PATCH 3/3] sysfs representation of stacked devices (md) (rev.2)

From: Jun'ichi Nomura
Date: Wed Feb 22 2006 - 11:10:16 EST


This patch modifies md driver to call bd_claim_by_kobject
and bd_release_from_kobject.

--
Jun'ichi Nomura, NEC Solutions (America), Inc.
Exporting stacked device relationship to sysfs (md)

Signed-off-by: Jun'ichi Nomura <j-nomura@xxxxxxxxxxxxx>

--- linux-2.6.15/drivers/md/md.c 2006-01-02 22:21:10.000000000 -0500
+++ linux-2.6.15/drivers/md/md.c 2006-02-21 19:11:16.000000000 -0500
@@ -1226,6 +1226,7 @@ static int bind_rdev_to_array(mdk_rdev_t
else
ko = &rdev->bdev->bd_disk->kobj;
sysfs_create_link(&rdev->kobj, ko, "block");
+ bd_claim_by_kobject(rdev->bdev, rdev, &mddev->gendisk->slave_dir);
return 0;
}

@@ -1236,6 +1237,7 @@ static void unbind_rdev_from_array(mdk_r
MD_BUG();
return;
}
+ bd_release_from_kobject(rdev->bdev, &rdev->mddev->gendisk->slave_dir);
list_del_init(&rdev->same_set);
printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b));
rdev->mddev = NULL;