summaryrefslogtreecommitdiff
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-06-18 08:47:55 +1000
committerNeilBrown <neilb@suse.de>2009-06-18 08:47:55 +1000
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)
return 1;
}
-static int raid5_check_reshape(mddev_t *mddev)
+static int check_reshape(mddev_t *mddev)
{
raid5_conf_t *conf = mddev->private;
if (mddev->delta_disks == 0 &&
mddev->new_layout == mddev->layout &&
mddev->new_chunk_sectors == mddev->chunk_sectors)
- return -EINVAL; /* nothing to do */
+ return 0; /* nothing to do */
if (mddev->bitmap)
/* Cannot grow a bitmap yet */
return -EBUSY;
@@ -5165,7 +5165,7 @@ static void *raid5_takeover_raid6(mddev_t *mddev)
}
-static int raid5_reconfig(mddev_t *mddev)
+static int raid5_check_reshape(mddev_t *mddev)
{
/* For a 2-drive array, the layout and chunk size can be changed
* immediately as not restriping is needed.
@@ -5202,12 +5202,13 @@ static int raid5_reconfig(mddev_t *mddev)
set_bit(MD_CHANGE_DEVS, &mddev->flags);
md_wakeup_thread(mddev->thread);
}
- return 0;
+ return check_reshape(mddev);
}
-static int raid6_reconfig(mddev_t *mddev)
+static int raid6_check_reshape(mddev_t *mddev)
{
int new_chunk = mddev->new_chunk_sectors;
+
if (mddev->new_layout >= 0 && !algorithm_valid_raid6(mddev->new_layout))
return -EINVAL;
if (new_chunk > 0) {
@@ -5221,7 +5222,7 @@ static int raid6_reconfig(mddev_t *mddev)
}
/* They look valid */
- return 0;
+ return check_reshape(mddev);
}
static void *raid5_takeover(mddev_t *mddev)
@@ -5312,12 +5313,11 @@ static struct mdk_personality raid6_personality =
.sync_request = sync_request,
.resize = raid5_resize,
.size = raid5_size,
- .check_reshape = raid5_check_reshape,
+ .check_reshape = raid6_check_reshape,
.start_reshape = raid5_start_reshape,
.finish_reshape = raid5_finish_reshape,
.quiesce = raid5_quiesce,
.takeover = raid6_takeover,
- .reconfig = raid6_reconfig,
};
static struct mdk_personality raid5_personality =
{
@@ -5340,7 +5340,6 @@ static struct mdk_personality raid5_personality =
.finish_reshape = raid5_finish_reshape,
.quiesce = raid5_quiesce,
.takeover = raid5_takeover,
- .reconfig = raid5_reconfig,
};
static struct mdk_personality raid4_personality =