diff options
author | NeilBrown <neilb@suse.de> | 2009-06-17 18:47:42 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-17 18:47:42 -0400 |
commit | 597a711b69cfff95c4b8f6069037e7ad3fc71f56 (patch) | |
tree | 8c2cfa4c1223827a560de2f14da426d4822151c4 /drivers/md/raid5.c | |
parent | 01ee22b496c41384eaa6dcae983c86d8bc32fbb8 (diff) |
md: remove unnecessary arguments from ->reconfig method.
Passing the new layout and chunksize as args is not necessary as
the mddev has fields for new_check and new_layout.
This is preparation for combining the check_reshape and reconfig
methods
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b84766e347c3..136051bc6725 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5165,7 +5165,7 @@ static void *raid5_takeover_raid6(mddev_t *mddev) | |||
5165 | } | 5165 | } |
5166 | 5166 | ||
5167 | 5167 | ||
5168 | static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) | 5168 | static int raid5_reconfig(mddev_t *mddev) |
5169 | { | 5169 | { |
5170 | /* For a 2-drive array, the layout and chunk size can be changed | 5170 | /* For a 2-drive array, the layout and chunk size can be changed |
5171 | * immediately as not restriping is needed. | 5171 | * immediately as not restriping is needed. |
@@ -5173,15 +5173,16 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) | |||
5173 | * to be used by a reshape pass. | 5173 | * to be used by a reshape pass. |
5174 | */ | 5174 | */ |
5175 | raid5_conf_t *conf = mddev->private; | 5175 | raid5_conf_t *conf = mddev->private; |
5176 | int new_chunk = mddev->new_chunk_sectors; | ||
5176 | 5177 | ||
5177 | if (new_layout >= 0 && !algorithm_valid_raid5(new_layout)) | 5178 | if (mddev->new_layout >= 0 && !algorithm_valid_raid5(mddev->new_layout)) |
5178 | return -EINVAL; | 5179 | return -EINVAL; |
5179 | if (new_chunk > 0) { | 5180 | if (new_chunk > 0) { |
5180 | if (!is_power_of_2(new_chunk)) | 5181 | if (!is_power_of_2(new_chunk)) |
5181 | return -EINVAL; | 5182 | return -EINVAL; |
5182 | if (new_chunk < PAGE_SIZE) | 5183 | if (new_chunk < (PAGE_SIZE>>9)) |
5183 | return -EINVAL; | 5184 | return -EINVAL; |
5184 | if (mddev->array_sectors & ((new_chunk>>9)-1)) | 5185 | if (mddev->array_sectors & (new_chunk-1)) |
5185 | /* not factor of array size */ | 5186 | /* not factor of array size */ |
5186 | return -EINVAL; | 5187 | return -EINVAL; |
5187 | } | 5188 | } |
@@ -5189,48 +5190,37 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) | |||
5189 | /* They look valid */ | 5190 | /* They look valid */ |
5190 | 5191 | ||
5191 | if (mddev->raid_disks == 2) { | 5192 | if (mddev->raid_disks == 2) { |
5192 | 5193 | /* can make the change immediately */ | |
5193 | if (new_layout >= 0) { | 5194 | if (mddev->new_layout >= 0) { |
5194 | conf->algorithm = new_layout; | 5195 | conf->algorithm = mddev->new_layout; |
5195 | mddev->layout = mddev->new_layout = new_layout; | 5196 | mddev->layout = mddev->new_layout; |
5196 | } | 5197 | } |
5197 | if (new_chunk > 0) { | 5198 | if (new_chunk > 0) { |
5198 | conf->chunk_sectors = new_chunk >> 9; | 5199 | conf->chunk_sectors = new_chunk ; |
5199 | mddev->new_chunk_sectors = new_chunk >> 9; | 5200 | mddev->chunk_sectors = new_chunk; |
5200 | mddev->chunk_sectors = new_chunk >> 9; | ||
5201 | } | 5201 | } |
5202 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 5202 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
5203 | md_wakeup_thread(mddev->thread); | 5203 | md_wakeup_thread(mddev->thread); |
5204 | } else { | ||
5205 | if (new_layout >= 0) | ||
5206 | mddev->new_layout = new_layout; | ||
5207 | if (new_chunk > 0) | ||
5208 | mddev->new_chunk_sectors = new_chunk >> 9; | ||
5209 | } | 5204 | } |
5210 | return 0; | 5205 | return 0; |
5211 | } | 5206 | } |
5212 | 5207 | ||
5213 | static int raid6_reconfig(mddev_t *mddev, int new_layout, int new_chunk) | 5208 | static int raid6_reconfig(mddev_t *mddev) |
5214 | { | 5209 | { |
5215 | if (new_layout >= 0 && !algorithm_valid_raid6(new_layout)) | 5210 | int new_chunk = mddev->new_chunk_sectors; |
5211 | if (mddev->new_layout >= 0 && !algorithm_valid_raid6(mddev->new_layout)) | ||
5216 | return -EINVAL; | 5212 | return -EINVAL; |
5217 | if (new_chunk > 0) { | 5213 | if (new_chunk > 0) { |
5218 | if (!is_power_of_2(new_chunk)) | 5214 | if (!is_power_of_2(new_chunk)) |
5219 | return -EINVAL; | 5215 | return -EINVAL; |
5220 | if (new_chunk < PAGE_SIZE) | 5216 | if (new_chunk < (PAGE_SIZE >> 9)) |
5221 | return -EINVAL; | 5217 | return -EINVAL; |
5222 | if (mddev->array_sectors & ((new_chunk>>9)-1)) | 5218 | if (mddev->array_sectors & (new_chunk-1)) |
5223 | /* not factor of array size */ | 5219 | /* not factor of array size */ |
5224 | return -EINVAL; | 5220 | return -EINVAL; |
5225 | } | 5221 | } |
5226 | 5222 | ||
5227 | /* They look valid */ | 5223 | /* They look valid */ |
5228 | |||
5229 | if (new_layout >= 0) | ||
5230 | mddev->new_layout = new_layout; | ||
5231 | if (new_chunk > 0) | ||
5232 | mddev->new_chunk_sectors = new_chunk >> 9; | ||
5233 | |||
5234 | return 0; | 5224 | return 0; |
5235 | } | 5225 | } |
5236 | 5226 | ||