aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@notabene.brown>2008-06-27 18:31:33 -0400
committerNeil Brown <neilb@notabene.brown>2008-06-27 18:31:33 -0400
commit199050ea1ff2270174ee525b73bc4c3323098897 (patch)
treeb2a7851511b2ddb943b9ff7ce7c8a96c3ac2a8bb /drivers/md/md.c
parent6c2fce2ef6b4821c21b5c42c7207cb9cf8c87eda (diff)
rationalise return value for ->hot_add_disk method.
For all array types but linear, ->hot_add_disk returns 1 on success, 0 on failure. For linear, it returns 0 on success and -errno on failure. This doesn't cause a functional problem because the ->hot_add_disk function of linear is used quite differently to the others. However it is confusing. So convert all to return 0 for success or -errno on failure and fix call sites to match. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5d6fac1fd39e..45e255d4916f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1977,10 +1977,8 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1977 rdev->saved_raid_disk = -1; 1977 rdev->saved_raid_disk = -1;
1978 err = rdev->mddev->pers-> 1978 err = rdev->mddev->pers->
1979 hot_add_disk(rdev->mddev, rdev); 1979 hot_add_disk(rdev->mddev, rdev);
1980 if (err != 1) { 1980 if (err) {
1981 rdev->raid_disk = -1; 1981 rdev->raid_disk = -1;
1982 if (err == 0)
1983 return -EEXIST;
1984 return err; 1982 return err;
1985 } 1983 }
1986 sprintf(nm, "rd%d", rdev->raid_disk); 1984 sprintf(nm, "rd%d", rdev->raid_disk);
@@ -5920,7 +5918,8 @@ static int remove_and_add_spares(mddev_t *mddev)
5920 if (rdev->raid_disk < 0 5918 if (rdev->raid_disk < 0
5921 && !test_bit(Faulty, &rdev->flags)) { 5919 && !test_bit(Faulty, &rdev->flags)) {
5922 rdev->recovery_offset = 0; 5920 rdev->recovery_offset = 0;
5923 if (mddev->pers->hot_add_disk(mddev,rdev)) { 5921 if (mddev->pers->
5922 hot_add_disk(mddev, rdev) == 0) {
5924 char nm[20]; 5923 char nm[20];
5925 sprintf(nm, "rd%d", rdev->raid_disk); 5924 sprintf(nm, "rd%d", rdev->raid_disk);
5926 if (sysfs_create_link(&mddev->kobj, 5925 if (sysfs_create_link(&mddev->kobj,