aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-06-17 18:47:55 -0400
committerNeilBrown <neilb@suse.de>2009-06-17 18:47:55 -0400
commit50ac168a6e0a061bf5346d53aa9e7beb94c97527 (patch)
tree4f1eff67793bd8349a1995c921a63e9512be7818 /drivers/md/raid5.c
parent597a711b69cfff95c4b8f6069037e7ad3fc71f56 (diff)
md: merge reconfig and check_reshape methods.
The difference between these two methods is artificial. Both check that a pending reshape is valid, and perform any aspect of it that can be done immediately. 'reconfig' handles chunk size and layout. 'check_reshape' handles raid_disks. So make them just one method. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 136051bc6725..5ea2bdece278 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4868,14 +4868,14 @@ static int check_stripe_cache(mddev_t *mddev)
4868 return 1; 4868 return 1;
4869} 4869}
4870 4870
4871static int raid5_check_reshape(mddev_t *mddev) 4871static int check_reshape(mddev_t *mddev)
4872{ 4872{
4873 raid5_conf_t *conf = mddev->private; 4873 raid5_conf_t *conf = mddev->private;
4874 4874
4875 if (mddev->delta_disks == 0 && 4875 if (mddev->delta_disks == 0 &&
4876 mddev->new_layout == mddev->layout && 4876 mddev->new_layout == mddev->layout &&
4877 mddev->new_chunk_sectors == mddev->chunk_sectors) 4877 mddev->new_chunk_sectors == mddev->chunk_sectors)
4878 return -EINVAL; /* nothing to do */ 4878 return 0; /* nothing to do */
4879 if (mddev->bitmap) 4879 if (mddev->bitmap)
4880 /* Cannot grow a bitmap yet */ 4880 /* Cannot grow a bitmap yet */
4881 return -EBUSY; 4881 return -EBUSY;
@@ -5165,7 +5165,7 @@ static void *raid5_takeover_raid6(mddev_t *mddev)
5165} 5165}
5166 5166
5167 5167
5168static int raid5_reconfig(mddev_t *mddev) 5168static int raid5_check_reshape(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.
@@ -5202,12 +5202,13 @@ static int raid5_reconfig(mddev_t *mddev)
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 } 5204 }
5205 return 0; 5205 return check_reshape(mddev);
5206} 5206}
5207 5207
5208static int raid6_reconfig(mddev_t *mddev) 5208static int raid6_check_reshape(mddev_t *mddev)
5209{ 5209{
5210 int new_chunk = mddev->new_chunk_sectors; 5210 int new_chunk = mddev->new_chunk_sectors;
5211
5211 if (mddev->new_layout >= 0 && !algorithm_valid_raid6(mddev->new_layout)) 5212 if (mddev->new_layout >= 0 && !algorithm_valid_raid6(mddev->new_layout))
5212 return -EINVAL; 5213 return -EINVAL;
5213 if (new_chunk > 0) { 5214 if (new_chunk > 0) {
@@ -5221,7 +5222,7 @@ static int raid6_reconfig(mddev_t *mddev)
5221 } 5222 }
5222 5223
5223 /* They look valid */ 5224 /* They look valid */
5224 return 0; 5225 return check_reshape(mddev);
5225} 5226}
5226 5227
5227static void *raid5_takeover(mddev_t *mddev) 5228static void *raid5_takeover(mddev_t *mddev)
@@ -5312,12 +5313,11 @@ static struct mdk_personality raid6_personality =
5312 .sync_request = sync_request, 5313 .sync_request = sync_request,
5313 .resize = raid5_resize, 5314 .resize = raid5_resize,
5314 .size = raid5_size, 5315 .size = raid5_size,
5315 .check_reshape = raid5_check_reshape, 5316 .check_reshape = raid6_check_reshape,
5316 .start_reshape = raid5_start_reshape, 5317 .start_reshape = raid5_start_reshape,
5317 .finish_reshape = raid5_finish_reshape, 5318 .finish_reshape = raid5_finish_reshape,
5318 .quiesce = raid5_quiesce, 5319 .quiesce = raid5_quiesce,
5319 .takeover = raid6_takeover, 5320 .takeover = raid6_takeover,
5320 .reconfig = raid6_reconfig,
5321}; 5321};
5322static struct mdk_personality raid5_personality = 5322static struct mdk_personality raid5_personality =
5323{ 5323{
@@ -5340,7 +5340,6 @@ static struct mdk_personality raid5_personality =
5340 .finish_reshape = raid5_finish_reshape, 5340 .finish_reshape = raid5_finish_reshape,
5341 .quiesce = raid5_quiesce, 5341 .quiesce = raid5_quiesce,
5342 .takeover = raid5_takeover, 5342 .takeover = raid5_takeover,
5343 .reconfig = raid5_reconfig,
5344}; 5343};
5345 5344
5346static struct mdk_personality raid4_personality = 5345static struct mdk_personality raid4_personality =