diff options
author | Andre Noll <maan@systemlinux.org> | 2009-06-17 18:45:55 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-17 18:45:55 -0400 |
commit | 09c9e5fa1b93ad5b81c9dcf8ce3a5b9ae2ac31e4 (patch) | |
tree | 2b8767d6a94654944f18ad96347fa6fcddf1eda0 | |
parent | 664e7c413f1e90eceb0b2596dd73a0832faec058 (diff) |
md: convert conf->chunk_size and conf->prev_chunk to sectors.
This kills some more shifts.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/raid5.c | 27 | ||||
-rw-r--r-- | drivers/md/raid5.h | 6 |
2 files changed, 17 insertions, 16 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index bc3564cfbba0..eaa2d3ee2b5d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1274,8 +1274,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1274 | sector_t new_sector; | 1274 | sector_t new_sector; |
1275 | int algorithm = previous ? conf->prev_algo | 1275 | int algorithm = previous ? conf->prev_algo |
1276 | : conf->algorithm; | 1276 | : conf->algorithm; |
1277 | int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) | 1277 | int sectors_per_chunk = previous ? conf->prev_chunk_sectors |
1278 | : (conf->chunk_size >> 9); | 1278 | : conf->chunk_sectors; |
1279 | int raid_disks = previous ? conf->previous_raid_disks | 1279 | int raid_disks = previous ? conf->previous_raid_disks |
1280 | : conf->raid_disks; | 1280 | : conf->raid_disks; |
1281 | int data_disks = raid_disks - conf->max_degraded; | 1281 | int data_disks = raid_disks - conf->max_degraded; |
@@ -1480,8 +1480,8 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) | |||
1480 | int raid_disks = sh->disks; | 1480 | int raid_disks = sh->disks; |
1481 | int data_disks = raid_disks - conf->max_degraded; | 1481 | int data_disks = raid_disks - conf->max_degraded; |
1482 | sector_t new_sector = sh->sector, check; | 1482 | sector_t new_sector = sh->sector, check; |
1483 | int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) | 1483 | int sectors_per_chunk = previous ? conf->prev_chunk_sectors |
1484 | : (conf->chunk_size >> 9); | 1484 | : conf->chunk_sectors; |
1485 | int algorithm = previous ? conf->prev_algo | 1485 | int algorithm = previous ? conf->prev_algo |
1486 | : conf->algorithm; | 1486 | : conf->algorithm; |
1487 | sector_t stripe; | 1487 | sector_t stripe; |
@@ -1997,8 +1997,7 @@ static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, | |||
1997 | struct stripe_head *sh) | 1997 | struct stripe_head *sh) |
1998 | { | 1998 | { |
1999 | int sectors_per_chunk = | 1999 | int sectors_per_chunk = |
2000 | previous ? (conf->prev_chunk >> 9) | 2000 | previous ? conf->prev_chunk_sectors : conf->chunk_sectors; |
2001 | : (conf->chunk_size >> 9); | ||
2002 | int dd_idx; | 2001 | int dd_idx; |
2003 | int chunk_offset = sector_div(stripe, sectors_per_chunk); | 2002 | int chunk_offset = sector_div(stripe, sectors_per_chunk); |
2004 | int disks = previous ? conf->previous_raid_disks : conf->raid_disks; | 2003 | int disks = previous ? conf->previous_raid_disks : conf->raid_disks; |
@@ -3917,7 +3916,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3917 | 1, &dd_idx, NULL); | 3916 | 1, &dd_idx, NULL); |
3918 | last_sector = | 3917 | last_sector = |
3919 | raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) | 3918 | raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) |
3920 | *(new_data_disks) - 1), | 3919 | * new_data_disks - 1), |
3921 | 1, &dd_idx, NULL); | 3920 | 1, &dd_idx, NULL); |
3922 | if (last_sector >= mddev->dev_sectors) | 3921 | if (last_sector >= mddev->dev_sectors) |
3923 | last_sector = mddev->dev_sectors - 1; | 3922 | last_sector = mddev->dev_sectors - 1; |
@@ -4403,7 +4402,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4403 | conf->fullsync = 1; | 4402 | conf->fullsync = 1; |
4404 | } | 4403 | } |
4405 | 4404 | ||
4406 | conf->chunk_size = mddev->new_chunk_sectors << 9; | 4405 | conf->chunk_sectors = mddev->new_chunk_sectors; |
4407 | conf->level = mddev->new_level; | 4406 | conf->level = mddev->new_level; |
4408 | if (conf->level == 6) | 4407 | if (conf->level == 6) |
4409 | conf->max_degraded = 2; | 4408 | conf->max_degraded = 2; |
@@ -4413,7 +4412,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4413 | conf->max_nr_stripes = NR_STRIPES; | 4412 | conf->max_nr_stripes = NR_STRIPES; |
4414 | conf->reshape_progress = mddev->reshape_position; | 4413 | conf->reshape_progress = mddev->reshape_position; |
4415 | if (conf->reshape_progress != MaxSector) { | 4414 | if (conf->reshape_progress != MaxSector) { |
4416 | conf->prev_chunk = mddev->chunk_sectors << 9; | 4415 | conf->prev_chunk_sectors = mddev->chunk_sectors; |
4417 | conf->prev_algo = mddev->layout; | 4416 | conf->prev_algo = mddev->layout; |
4418 | } | 4417 | } |
4419 | 4418 | ||
@@ -4931,8 +4930,8 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
4931 | spin_lock_irq(&conf->device_lock); | 4930 | spin_lock_irq(&conf->device_lock); |
4932 | conf->previous_raid_disks = conf->raid_disks; | 4931 | conf->previous_raid_disks = conf->raid_disks; |
4933 | conf->raid_disks += mddev->delta_disks; | 4932 | conf->raid_disks += mddev->delta_disks; |
4934 | conf->prev_chunk = conf->chunk_size; | 4933 | conf->prev_chunk_sectors = conf->chunk_sectors; |
4935 | conf->chunk_size = mddev->new_chunk_sectors << 9; | 4934 | conf->chunk_sectors = mddev->new_chunk_sectors; |
4936 | conf->prev_algo = conf->algorithm; | 4935 | conf->prev_algo = conf->algorithm; |
4937 | conf->algorithm = mddev->new_layout; | 4936 | conf->algorithm = mddev->new_layout; |
4938 | if (mddev->delta_disks < 0) | 4937 | if (mddev->delta_disks < 0) |
@@ -5014,7 +5013,7 @@ static void end_reshape(raid5_conf_t *conf) | |||
5014 | */ | 5013 | */ |
5015 | { | 5014 | { |
5016 | int data_disks = conf->raid_disks - conf->max_degraded; | 5015 | int data_disks = conf->raid_disks - conf->max_degraded; |
5017 | int stripe = data_disks * (conf->chunk_size | 5016 | int stripe = data_disks * ((conf->chunk_sectors << 9) |
5018 | / PAGE_SIZE); | 5017 | / PAGE_SIZE); |
5019 | if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) | 5018 | if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) |
5020 | conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; | 5019 | conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; |
@@ -5059,7 +5058,7 @@ static void raid5_finish_reshape(mddev_t *mddev) | |||
5059 | raid5_remove_disk(mddev, d); | 5058 | raid5_remove_disk(mddev, d); |
5060 | } | 5059 | } |
5061 | mddev->layout = conf->algorithm; | 5060 | mddev->layout = conf->algorithm; |
5062 | mddev->chunk_sectors = conf->chunk_size >> 9; | 5061 | mddev->chunk_sectors = conf->chunk_sectors; |
5063 | mddev->reshape_position = MaxSector; | 5062 | mddev->reshape_position = MaxSector; |
5064 | mddev->delta_disks = 0; | 5063 | mddev->delta_disks = 0; |
5065 | } | 5064 | } |
@@ -5187,7 +5186,7 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) | |||
5187 | mddev->layout = mddev->new_layout = new_layout; | 5186 | mddev->layout = mddev->new_layout = new_layout; |
5188 | } | 5187 | } |
5189 | if (new_chunk > 0) { | 5188 | if (new_chunk > 0) { |
5190 | conf->chunk_size = new_chunk; | 5189 | conf->chunk_sectors = new_chunk >> 9; |
5191 | mddev->new_chunk_sectors = new_chunk >> 9; | 5190 | mddev->new_chunk_sectors = new_chunk >> 9; |
5192 | mddev->chunk_sectors = new_chunk >> 9; | 5191 | mddev->chunk_sectors = new_chunk >> 9; |
5193 | } | 5192 | } |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 1a25c9e252b4..9459689c4ea0 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -334,7 +334,8 @@ struct raid5_private_data { | |||
334 | struct hlist_head *stripe_hashtbl; | 334 | struct hlist_head *stripe_hashtbl; |
335 | mddev_t *mddev; | 335 | mddev_t *mddev; |
336 | struct disk_info *spare; | 336 | struct disk_info *spare; |
337 | int chunk_size, level, algorithm; | 337 | int chunk_sectors; |
338 | int level, algorithm; | ||
338 | int max_degraded; | 339 | int max_degraded; |
339 | int raid_disks; | 340 | int raid_disks; |
340 | int max_nr_stripes; | 341 | int max_nr_stripes; |
@@ -350,7 +351,8 @@ struct raid5_private_data { | |||
350 | */ | 351 | */ |
351 | sector_t reshape_safe; | 352 | sector_t reshape_safe; |
352 | int previous_raid_disks; | 353 | int previous_raid_disks; |
353 | int prev_chunk, prev_algo; | 354 | int prev_chunk_sectors; |
355 | int prev_algo; | ||
354 | short generation; /* increments with every reshape */ | 356 | short generation; /* increments with every reshape */ |
355 | unsigned long reshape_checkpoint; /* Time we last updated | 357 | unsigned long reshape_checkpoint; /* Time we last updated |
356 | * metadata */ | 358 | * metadata */ |