diff options
author | Neil Brown <neilb@notabene.brown> | 2008-06-28 08:31:33 +1000 |
---|---|---|
committer | Neil Brown <neilb@notabene.brown> | 2008-06-28 08:31:33 +1000 |
commit | 199050ea1ff2270174ee525b73bc4c3323098897 (patch) | |
tree | b2a7851511b2ddb943b9ff7ce7c8a96c3ac2a8bb /drivers/md/md.c | |
parent | 6c2fce2ef6b4821c21b5c42c7207cb9cf8c87eda (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.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5d6fac1fd39..45e255d4916 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) rdev->saved_raid_disk = -1; err = rdev->mddev->pers-> hot_add_disk(rdev->mddev, rdev); - if (err != 1) { + if (err) { rdev->raid_disk = -1; - if (err == 0) - return -EEXIST; return err; } sprintf(nm, "rd%d", rdev->raid_disk); @@ -5920,7 +5918,8 @@ static int remove_and_add_spares(mddev_t *mddev) if (rdev->raid_disk < 0 && !test_bit(Faulty, &rdev->flags)) { rdev->recovery_offset = 0; - if (mddev->pers->hot_add_disk(mddev,rdev)) { + if (mddev->pers-> + hot_add_disk(mddev, rdev) == 0) { char nm[20]; sprintf(nm, "rd%d", rdev->raid_disk); if (sysfs_create_link(&mddev->kobj, |