diff options
author | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:33 -0400 |
---|---|---|
committer | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:33 -0400 |
commit | 199050ea1ff2270174ee525b73bc4c3323098897 (patch) | |
tree | b2a7851511b2ddb943b9ff7ce7c8a96c3ac2a8bb /drivers/md/raid5.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/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 002f33b1ae00..8c4e6149daea 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4604,7 +4604,7 @@ abort: | |||
4604 | static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 4604 | static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
4605 | { | 4605 | { |
4606 | raid5_conf_t *conf = mddev->private; | 4606 | raid5_conf_t *conf = mddev->private; |
4607 | int found = 0; | 4607 | int err = -EEXIST; |
4608 | int disk; | 4608 | int disk; |
4609 | struct disk_info *p; | 4609 | struct disk_info *p; |
4610 | int first = 0; | 4610 | int first = 0; |
@@ -4612,7 +4612,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4612 | 4612 | ||
4613 | if (mddev->degraded > conf->max_degraded) | 4613 | if (mddev->degraded > conf->max_degraded) |
4614 | /* no point adding a device */ | 4614 | /* no point adding a device */ |
4615 | return 0; | 4615 | return -EINVAL; |
4616 | 4616 | ||
4617 | if (rdev->raid_disk >= 0) | 4617 | if (rdev->raid_disk >= 0) |
4618 | first = last = rdev->raid_disk; | 4618 | first = last = rdev->raid_disk; |
@@ -4631,14 +4631,14 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4631 | if ((p=conf->disks + disk)->rdev == NULL) { | 4631 | if ((p=conf->disks + disk)->rdev == NULL) { |
4632 | clear_bit(In_sync, &rdev->flags); | 4632 | clear_bit(In_sync, &rdev->flags); |
4633 | rdev->raid_disk = disk; | 4633 | rdev->raid_disk = disk; |
4634 | found = 1; | 4634 | err = 0; |
4635 | if (rdev->saved_raid_disk != disk) | 4635 | if (rdev->saved_raid_disk != disk) |
4636 | conf->fullsync = 1; | 4636 | conf->fullsync = 1; |
4637 | rcu_assign_pointer(p->rdev, rdev); | 4637 | rcu_assign_pointer(p->rdev, rdev); |
4638 | break; | 4638 | break; |
4639 | } | 4639 | } |
4640 | print_raid5_conf(conf); | 4640 | print_raid5_conf(conf); |
4641 | return found; | 4641 | return err; |
4642 | } | 4642 | } |
4643 | 4643 | ||
4644 | static int raid5_resize(mddev_t *mddev, sector_t sectors) | 4644 | static int raid5_resize(mddev_t *mddev, sector_t sectors) |
@@ -4739,7 +4739,7 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
4739 | rdev_for_each(rdev, rtmp, mddev) | 4739 | rdev_for_each(rdev, rtmp, mddev) |
4740 | if (rdev->raid_disk < 0 && | 4740 | if (rdev->raid_disk < 0 && |
4741 | !test_bit(Faulty, &rdev->flags)) { | 4741 | !test_bit(Faulty, &rdev->flags)) { |
4742 | if (raid5_add_disk(mddev, rdev)) { | 4742 | if (raid5_add_disk(mddev, rdev) == 0) { |
4743 | char nm[20]; | 4743 | char nm[20]; |
4744 | set_bit(In_sync, &rdev->flags); | 4744 | set_bit(In_sync, &rdev->flags); |
4745 | added_devices++; | 4745 | added_devices++; |