aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-07-26 21:00:36 -0400
committerNeilBrown <neilb@suse.de>2011-07-26 21:00:36 -0400
commit36fad858a7404a9656122a9e560a224ae2a00979 (patch)
tree95f8a7a6b8dad6bb8d7c7735f7845888b5e702db /drivers/md/raid1.c
parent8bda470e8ebde35f9349e98ecbce4dfb508a60fa (diff)
md: introduce link/unlink_rdev() helpers
There are places where sysfs links to rdev are handled in a same way. Add the helper functions to consolidate them. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d3a8f4bb4fc3..1d79a041db09 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2159,18 +2159,13 @@ static int raid1_reshape(mddev_t *mddev)
2159 for (d = d2 = 0; d < conf->raid_disks; d++) { 2159 for (d = d2 = 0; d < conf->raid_disks; d++) {
2160 mdk_rdev_t *rdev = conf->mirrors[d].rdev; 2160 mdk_rdev_t *rdev = conf->mirrors[d].rdev;
2161 if (rdev && rdev->raid_disk != d2) { 2161 if (rdev && rdev->raid_disk != d2) {
2162 char nm[20]; 2162 sysfs_unlink_rdev(mddev, rdev);
2163 sprintf(nm, "rd%d", rdev->raid_disk);
2164 sysfs_remove_link(&mddev->kobj, nm);
2165 rdev->raid_disk = d2; 2163 rdev->raid_disk = d2;
2166 sprintf(nm, "rd%d", rdev->raid_disk); 2164 sysfs_unlink_rdev(mddev, rdev);
2167 sysfs_remove_link(&mddev->kobj, nm); 2165 if (sysfs_link_rdev(mddev, rdev))
2168 if (sysfs_create_link(&mddev->kobj,
2169 &rdev->kobj, nm))
2170 printk(KERN_WARNING 2166 printk(KERN_WARNING
2171 "md/raid1:%s: cannot register " 2167 "md/raid1:%s: cannot register rd%d\n",
2172 "%s\n", 2168 mdname(mddev), rdev->raid_disk);
2173 mdname(mddev), nm);
2174 } 2169 }
2175 if (rdev) 2170 if (rdev)
2176 newmirrors[d2++].rdev = rdev; 2171 newmirrors[d2++].rdev = rdev;