diff options
author | Andre Noll <maan@systemlinux.org> | 2009-06-17 18:45:01 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-17 18:45:01 -0400 |
commit | 9d8f0363623b3da12c43007cf77f5e1a4e8a5964 (patch) | |
tree | 0fee53971a397ade209dd36c4f1ed50db6450faf /drivers/md/raid10.c | |
parent | fbb704efb784e2c8418e34dc3013af76bdd58101 (diff) |
md: Make mddev->chunk_size sector-based.
This patch renames the chunk_size field to chunk_sectors with the
implied change of semantics. Since
is_power_of_2(chunk_size) = is_power_of_2(chunk_sectors << 9)
= is_power_of_2(chunk_sectors)
these bits don't need an adjustment for the shift.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 06bef686f91b..30029a312cf5 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -461,7 +461,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, | |||
461 | mddev_t *mddev = q->queuedata; | 461 | mddev_t *mddev = q->queuedata; |
462 | sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); | 462 | sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); |
463 | int max; | 463 | int max; |
464 | unsigned int chunk_sectors = mddev->chunk_size >> 9; | 464 | unsigned int chunk_sectors = mddev->chunk_sectors; |
465 | unsigned int bio_sectors = bvm->bi_size >> 9; | 465 | unsigned int bio_sectors = bvm->bi_size >> 9; |
466 | 466 | ||
467 | max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9; | 467 | max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9; |
@@ -985,7 +985,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) | |||
985 | int i; | 985 | int i; |
986 | 986 | ||
987 | if (conf->near_copies < conf->raid_disks) | 987 | if (conf->near_copies < conf->raid_disks) |
988 | seq_printf(seq, " %dK chunks", mddev->chunk_size/1024); | 988 | seq_printf(seq, " %dK chunks", mddev->chunk_sectors / 2); |
989 | if (conf->near_copies > 1) | 989 | if (conf->near_copies > 1) |
990 | seq_printf(seq, " %d near-copies", conf->near_copies); | 990 | seq_printf(seq, " %d near-copies", conf->near_copies); |
991 | if (conf->far_copies > 1) { | 991 | if (conf->far_copies > 1) { |
@@ -2050,8 +2050,8 @@ static int run(mddev_t *mddev) | |||
2050 | int nc, fc, fo; | 2050 | int nc, fc, fo; |
2051 | sector_t stride, size; | 2051 | sector_t stride, size; |
2052 | 2052 | ||
2053 | if (mddev->chunk_size < PAGE_SIZE || | 2053 | if (mddev->chunk_sectors < (PAGE_SIZE >> 9) || |
2054 | !is_power_of_2(mddev->chunk_size)) { | 2054 | !is_power_of_2(mddev->chunk_sectors)) { |
2055 | printk(KERN_ERR "md/raid10: chunk size must be " | 2055 | printk(KERN_ERR "md/raid10: chunk size must be " |
2056 | "at least PAGE_SIZE(%ld) and be a power of 2.\n", PAGE_SIZE); | 2056 | "at least PAGE_SIZE(%ld) and be a power of 2.\n", PAGE_SIZE); |
2057 | return -EINVAL; | 2057 | return -EINVAL; |
@@ -2096,8 +2096,8 @@ static int run(mddev_t *mddev) | |||
2096 | conf->far_copies = fc; | 2096 | conf->far_copies = fc; |
2097 | conf->copies = nc*fc; | 2097 | conf->copies = nc*fc; |
2098 | conf->far_offset = fo; | 2098 | conf->far_offset = fo; |
2099 | conf->chunk_mask = (sector_t)(mddev->chunk_size>>9)-1; | 2099 | conf->chunk_mask = mddev->chunk_sectors - 1; |
2100 | conf->chunk_shift = ffz(~mddev->chunk_size) - 9; | 2100 | conf->chunk_shift = ffz(~mddev->chunk_sectors); |
2101 | size = mddev->dev_sectors >> conf->chunk_shift; | 2101 | size = mddev->dev_sectors >> conf->chunk_shift; |
2102 | sector_div(size, fc); | 2102 | sector_div(size, fc); |
2103 | size = size * conf->raid_disks; | 2103 | size = size * conf->raid_disks; |
@@ -2205,7 +2205,8 @@ static int run(mddev_t *mddev) | |||
2205 | * maybe... | 2205 | * maybe... |
2206 | */ | 2206 | */ |
2207 | { | 2207 | { |
2208 | int stripe = conf->raid_disks * (mddev->chunk_size / PAGE_SIZE); | 2208 | int stripe = conf->raid_disks * |
2209 | ((mddev->chunk_sectors << 9) / PAGE_SIZE); | ||
2209 | stripe /= conf->near_copies; | 2210 | stripe /= conf->near_copies; |
2210 | if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) | 2211 | if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) |
2211 | mddev->queue->backing_dev_info.ra_pages = 2* stripe; | 2212 | mddev->queue->backing_dev_info.ra_pages = 2* stripe; |