diff options
author | Namhyung Kim <namhyung@gmail.com> | 2011-07-27 05:00:36 +0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-07-27 05:00:36 +0400 |
commit | 36fad858a7404a9656122a9e560a224ae2a00979 (patch) | |
tree | 95f8a7a6b8dad6bb8d7c7735f7845888b5e702db /drivers/md/raid5.c | |
parent | 8bda470e8ebde35f9349e98ecbce4dfb508a60fa (diff) | |
download | linux-36fad858a7404a9656122a9e560a224ae2a00979.tar.xz |
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/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 467e8e1cd3d2..0cd591472e1f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5152,16 +5152,14 @@ static int raid5_start_reshape(mddev_t *mddev) if (rdev->raid_disk < 0 && !test_bit(Faulty, &rdev->flags)) { if (raid5_add_disk(mddev, rdev) == 0) { - char nm[20]; if (rdev->raid_disk >= conf->previous_raid_disks) { set_bit(In_sync, &rdev->flags); added_devices++; } else rdev->recovery_offset = 0; - sprintf(nm, "rd%d", rdev->raid_disk); - if (sysfs_create_link(&mddev->kobj, - &rdev->kobj, nm)) + + if (sysfs_link_rdev(mddev, rdev)) /* Failure here is OK */; } } else if (rdev->raid_disk >= conf->previous_raid_disks @@ -5257,9 +5255,7 @@ static void raid5_finish_reshape(mddev_t *mddev) d++) { mdk_rdev_t *rdev = conf->disks[d].rdev; if (rdev && raid5_remove_disk(mddev, d) == 0) { - char nm[20]; - sprintf(nm, "rd%d", rdev->raid_disk); - sysfs_remove_link(&mddev->kobj, nm); + sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = -1; } } |