raid5: don't allow resize/reshape with cache(log) support

If cache(log) support is enabled, don't allow resize/reshape in current
stage. In the future, we can flush all data from cache(log) to raid
before resize/reshape and then allow resize/reshape.

Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
Shaohua Li 2015-08-13 14:32:03 -07:00 committed by NeilBrown
parent 9c3e333d3f
commit 713cf5a639

View File

@ -6663,6 +6663,7 @@ static int run(struct mddev *mddev)
int working_disks = 0; int working_disks = 0;
int dirty_parity_disks = 0; int dirty_parity_disks = 0;
struct md_rdev *rdev; struct md_rdev *rdev;
struct md_rdev *journal_dev = NULL;
sector_t reshape_offset = 0; sector_t reshape_offset = 0;
int i; int i;
long long min_offset_diff = 0; long long min_offset_diff = 0;
@ -6675,6 +6676,9 @@ static int run(struct mddev *mddev)
rdev_for_each(rdev, mddev) { rdev_for_each(rdev, mddev) {
long long diff; long long diff;
if (test_bit(Journal, &rdev->flags))
journal_dev = rdev;
if (rdev->raid_disk < 0) if (rdev->raid_disk < 0)
continue; continue;
diff = (rdev->new_data_offset - rdev->data_offset); diff = (rdev->new_data_offset - rdev->data_offset);
@ -6708,6 +6712,12 @@ static int run(struct mddev *mddev)
int chunk_sectors; int chunk_sectors;
int new_data_disks; int new_data_disks;
if (journal_dev) {
printk(KERN_ERR "md/raid:%s: don't support reshape with journal - aborting.\n",
mdname(mddev));
return -EINVAL;
}
if (mddev->new_level != mddev->level) { if (mddev->new_level != mddev->level) {
printk(KERN_ERR "md/raid:%s: unsupported reshape " printk(KERN_ERR "md/raid:%s: unsupported reshape "
"required - aborting.\n", "required - aborting.\n",
@ -7218,6 +7228,8 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
sector_t newsize; sector_t newsize;
struct r5conf *conf = mddev->private; struct r5conf *conf = mddev->private;
if (conf->log)
return -EINVAL;
sectors &= ~((sector_t)conf->chunk_sectors - 1); sectors &= ~((sector_t)conf->chunk_sectors - 1);
newsize = raid5_size(mddev, sectors, mddev->raid_disks); newsize = raid5_size(mddev, sectors, mddev->raid_disks);
if (mddev->external_size && if (mddev->external_size &&
@ -7269,6 +7281,8 @@ static int check_reshape(struct mddev *mddev)
{ {
struct r5conf *conf = mddev->private; struct r5conf *conf = mddev->private;
if (conf->log)
return -EINVAL;
if (mddev->delta_disks == 0 && if (mddev->delta_disks == 0 &&
mddev->new_layout == mddev->layout && mddev->new_layout == mddev->layout &&
mddev->new_chunk_sectors == mddev->chunk_sectors) mddev->new_chunk_sectors == mddev->chunk_sectors)