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/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 002f33b1ae0..8c4e6149dae 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4604,7 +4604,7 @@ abort: static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) { raid5_conf_t *conf = mddev->private; - int found = 0; + int err = -EEXIST; int disk; struct disk_info *p; int first = 0; @@ -4612,7 +4612,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) if (mddev->degraded > conf->max_degraded) /* no point adding a device */ - return 0; + return -EINVAL; if (rdev->raid_disk >= 0) first = last = rdev->raid_disk; @@ -4631,14 +4631,14 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) if ((p=conf->disks + disk)->rdev == NULL) { clear_bit(In_sync, &rdev->flags); rdev->raid_disk = disk; - found = 1; + err = 0; if (rdev->saved_raid_disk != disk) conf->fullsync = 1; rcu_assign_pointer(p->rdev, rdev); break; } print_raid5_conf(conf); - return found; + return err; } static int raid5_resize(mddev_t *mddev, sector_t sectors) @@ -4739,7 +4739,7 @@ static int raid5_start_reshape(mddev_t *mddev) rdev_for_each(rdev, rtmp, mddev) if (rdev->raid_disk < 0 && !test_bit(Faulty, &rdev->flags)) { - if (raid5_add_disk(mddev, rdev)) { + if (raid5_add_disk(mddev, rdev) == 0) { char nm[20]; set_bit(In_sync, &rdev->flags); added_devices++; |