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/raid10.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/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 50ad8d2ae0e8..df08a9fa3a1f 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1113,7 +1113,7 @@ static int raid10_spare_active(mddev_t *mddev) | |||
1113 | static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 1113 | static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
1114 | { | 1114 | { |
1115 | conf_t *conf = mddev->private; | 1115 | conf_t *conf = mddev->private; |
1116 | int found = 0; | 1116 | int err = -EEXIST; |
1117 | int mirror; | 1117 | int mirror; |
1118 | mirror_info_t *p; | 1118 | mirror_info_t *p; |
1119 | int first = 0; | 1119 | int first = 0; |
@@ -1123,9 +1123,9 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1123 | /* only hot-add to in-sync arrays, as recovery is | 1123 | /* only hot-add to in-sync arrays, as recovery is |
1124 | * very different from resync | 1124 | * very different from resync |
1125 | */ | 1125 | */ |
1126 | return 0; | 1126 | return -EBUSY; |
1127 | if (!enough(conf)) | 1127 | if (!enough(conf)) |
1128 | return 0; | 1128 | return -EINVAL; |
1129 | 1129 | ||
1130 | if (rdev->raid_disk) | 1130 | if (rdev->raid_disk) |
1131 | first = last = rdev->raid_disk; | 1131 | first = last = rdev->raid_disk; |
@@ -1151,7 +1151,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1151 | 1151 | ||
1152 | p->head_position = 0; | 1152 | p->head_position = 0; |
1153 | rdev->raid_disk = mirror; | 1153 | rdev->raid_disk = mirror; |
1154 | found = 1; | 1154 | err = 0; |
1155 | if (rdev->saved_raid_disk != mirror) | 1155 | if (rdev->saved_raid_disk != mirror) |
1156 | conf->fullsync = 1; | 1156 | conf->fullsync = 1; |
1157 | rcu_assign_pointer(p->rdev, rdev); | 1157 | rcu_assign_pointer(p->rdev, rdev); |
@@ -1159,7 +1159,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | print_conf(conf); | 1161 | print_conf(conf); |
1162 | return found; | 1162 | return err; |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | static int raid10_remove_disk(mddev_t *mddev, int number) | 1165 | static int raid10_remove_disk(mddev_t *mddev, int number) |