Gitweb: http://git.kernel.org/linus/e183eaedd53807e33f02ee80573e2833890e1f21
Commit: e183eaedd53807e33f02ee80573e2833890e1f21
Parent: 784052ecc6ade6b6acf4f67e4ada8e5f2e6df446
Author: NeilBrown <neilb@suse.de>
AuthorDate: Tue Mar 31 15:20:22 2009 +1100
Committer: NeilBrown <neilb@suse.de>
CommitDate: Tue Mar 31 15:20:22 2009 +1100
md/raid5: prepare for allowing reshape to change layout
Add prev_algo to raid5_conf_t along the same lines as prev_chunk
and previous_raid_disks.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/raid5.c | 32 +++++++++++++++++++-------------
drivers/md/raid5.h | 2 +-
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7638cc3..80ec9a6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1273,6 +1273,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
int pd_idx, qd_idx;
int ddf_layout = 0;
sector_t new_sector;
+ int algorithm = previous ? conf->prev_algo
+ : conf->algorithm;
int sectors_per_chunk = previous ? (conf->prev_chunk >> 9)
: (conf->chunk_size >> 9);
int raid_disks = previous ? conf->previous_raid_disks
@@ -1307,7 +1309,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
pd_idx = data_disks;
break;
case 5:
- switch (conf->algorithm) {
+ switch (algorithm) {
case ALGORITHM_LEFT_ASYMMETRIC:
pd_idx = data_disks - stripe % raid_disks;
if (*dd_idx >= pd_idx)
@@ -1335,13 +1337,13 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
break;
default:
printk(KERN_ERR "raid5: unsupported algorithm %d\n",
- conf->algorithm);
+ algorithm);
BUG();
}
break;
case 6:
- switch (conf->algorithm) {
+ switch (algorithm) {
case ALGORITHM_LEFT_ASYMMETRIC:
pd_idx = raid_disks - 1 - (stripe % raid_disks);
qd_idx = pd_idx + 1;
@@ -1454,7 +1456,7 @@ static ...