diff options
-rw-r--r-- | drivers/md/linear.c | 4 | ||||
-rw-r--r-- | drivers/md/md.c | 96 | ||||
-rw-r--r-- | drivers/md/md.h | 2 | ||||
-rw-r--r-- | drivers/md/raid0.c | 41 |
4 files changed, 71 insertions, 72 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index f2488343ed4a..d5d99290041a 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -139,8 +139,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
139 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) | 139 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) |
140 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 140 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); |
141 | 141 | ||
142 | disk->num_sectors = rdev->size * 2; | 142 | disk->num_sectors = rdev->sectors; |
143 | conf->array_sectors += rdev->size * 2; | 143 | conf->array_sectors += rdev->sectors; |
144 | 144 | ||
145 | cnt++; | 145 | cnt++; |
146 | } | 146 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index be4a131e8c01..07ab6790e29d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -413,7 +413,7 @@ static void free_disk_sb(mdk_rdev_t * rdev) | |||
413 | rdev->sb_loaded = 0; | 413 | rdev->sb_loaded = 0; |
414 | rdev->sb_page = NULL; | 414 | rdev->sb_page = NULL; |
415 | rdev->sb_start = 0; | 415 | rdev->sb_start = 0; |
416 | rdev->size = 0; | 416 | rdev->sectors = 0; |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
@@ -779,9 +779,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version | |||
779 | else | 779 | else |
780 | ret = 0; | 780 | ret = 0; |
781 | } | 781 | } |
782 | rdev->size = calc_num_sectors(rdev, sb->chunk_size) / 2; | 782 | rdev->sectors = calc_num_sectors(rdev, sb->chunk_size); |
783 | 783 | ||
784 | if (rdev->size < sb->size && sb->level > 1) | 784 | if (rdev->sectors < sb->size * 2 && sb->level > 1) |
785 | /* "this cannot possibly happen" ... */ | 785 | /* "this cannot possibly happen" ... */ |
786 | ret = -EINVAL; | 786 | ret = -EINVAL; |
787 | 787 | ||
@@ -1184,16 +1184,17 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) | |||
1184 | ret = 0; | 1184 | ret = 0; |
1185 | } | 1185 | } |
1186 | if (minor_version) | 1186 | if (minor_version) |
1187 | rdev->size = ((rdev->bdev->bd_inode->i_size>>9) - le64_to_cpu(sb->data_offset)) / 2; | 1187 | rdev->sectors = (rdev->bdev->bd_inode->i_size >> 9) - |
1188 | le64_to_cpu(sb->data_offset); | ||
1188 | else | 1189 | else |
1189 | rdev->size = rdev->sb_start / 2; | 1190 | rdev->sectors = rdev->sb_start; |
1190 | if (rdev->size < le64_to_cpu(sb->data_size)/2) | 1191 | if (rdev->sectors < le64_to_cpu(sb->data_size)) |
1191 | return -EINVAL; | 1192 | return -EINVAL; |
1192 | rdev->size = le64_to_cpu(sb->data_size)/2; | 1193 | rdev->sectors = le64_to_cpu(sb->data_size); |
1193 | if (le32_to_cpu(sb->chunksize)) | 1194 | if (le32_to_cpu(sb->chunksize)) |
1194 | rdev->size &= ~((sector_t)le32_to_cpu(sb->chunksize)/2 - 1); | 1195 | rdev->sectors &= ~((sector_t)le32_to_cpu(sb->chunksize) - 1); |
1195 | 1196 | ||
1196 | if (le64_to_cpu(sb->size) > rdev->size*2) | 1197 | if (le64_to_cpu(sb->size) > rdev->sectors) |
1197 | return -EINVAL; | 1198 | return -EINVAL; |
1198 | return ret; | 1199 | return ret; |
1199 | } | 1200 | } |
@@ -1390,7 +1391,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
1390 | sector_t sb_start; | 1391 | sector_t sb_start; |
1391 | sb_start = (rdev->bdev->bd_inode->i_size >> 9) - 8*2; | 1392 | sb_start = (rdev->bdev->bd_inode->i_size >> 9) - 8*2; |
1392 | sb_start &= ~(sector_t)(4*2 - 1); | 1393 | sb_start &= ~(sector_t)(4*2 - 1); |
1393 | max_sectors = rdev->size * 2 + sb_start - rdev->sb_start; | 1394 | max_sectors = rdev->sectors + sb_start - rdev->sb_start; |
1394 | if (!num_sectors || num_sectors > max_sectors) | 1395 | if (!num_sectors || num_sectors > max_sectors) |
1395 | num_sectors = max_sectors; | 1396 | num_sectors = max_sectors; |
1396 | rdev->sb_start = sb_start; | 1397 | rdev->sb_start = sb_start; |
@@ -1490,9 +1491,9 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1490 | if (find_rdev(mddev, rdev->bdev->bd_dev)) | 1491 | if (find_rdev(mddev, rdev->bdev->bd_dev)) |
1491 | return -EEXIST; | 1492 | return -EEXIST; |
1492 | 1493 | ||
1493 | /* make sure rdev->size exceeds mddev->dev_sectors / 2 */ | 1494 | /* make sure rdev->sectors exceeds mddev->dev_sectors */ |
1494 | if (rdev->size && (mddev->dev_sectors == 0 || | 1495 | if (rdev->sectors && (mddev->dev_sectors == 0 || |
1495 | rdev->size < mddev->dev_sectors / 2)) { | 1496 | rdev->sectors < mddev->dev_sectors)) { |
1496 | if (mddev->pers) { | 1497 | if (mddev->pers) { |
1497 | /* Cannot change size, so fail | 1498 | /* Cannot change size, so fail |
1498 | * If mddev->level <= 0, then we don't care | 1499 | * If mddev->level <= 0, then we don't care |
@@ -1501,7 +1502,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1501 | if (mddev->level > 0) | 1502 | if (mddev->level > 0) |
1502 | return -ENOSPC; | 1503 | return -ENOSPC; |
1503 | } else | 1504 | } else |
1504 | mddev->dev_sectors = rdev->size * 2; | 1505 | mddev->dev_sectors = rdev->sectors; |
1505 | } | 1506 | } |
1506 | 1507 | ||
1507 | /* Verify rdev->desc_nr is unique. | 1508 | /* Verify rdev->desc_nr is unique. |
@@ -1757,8 +1758,8 @@ static void print_sb_1(struct mdp_superblock_1 *sb) | |||
1757 | static void print_rdev(mdk_rdev_t *rdev, int major_version) | 1758 | static void print_rdev(mdk_rdev_t *rdev, int major_version) |
1758 | { | 1759 | { |
1759 | char b[BDEVNAME_SIZE]; | 1760 | char b[BDEVNAME_SIZE]; |
1760 | printk(KERN_INFO "md: rdev %s, SZ:%08llu F:%d S:%d DN:%u\n", | 1761 | printk(KERN_INFO "md: rdev %s, Sect:%08llu F:%d S:%d DN:%u\n", |
1761 | bdevname(rdev->bdev,b), (unsigned long long)rdev->size, | 1762 | bdevname(rdev->bdev, b), (unsigned long long)rdev->sectors, |
1762 | test_bit(Faulty, &rdev->flags), test_bit(In_sync, &rdev->flags), | 1763 | test_bit(Faulty, &rdev->flags), test_bit(In_sync, &rdev->flags), |
1763 | rdev->desc_nr); | 1764 | rdev->desc_nr); |
1764 | if (rdev->sb_loaded) { | 1765 | if (rdev->sb_loaded) { |
@@ -2197,7 +2198,7 @@ offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2197 | return -EINVAL; | 2198 | return -EINVAL; |
2198 | if (rdev->mddev->pers && rdev->raid_disk >= 0) | 2199 | if (rdev->mddev->pers && rdev->raid_disk >= 0) |
2199 | return -EBUSY; | 2200 | return -EBUSY; |
2200 | if (rdev->size && rdev->mddev->external) | 2201 | if (rdev->sectors && rdev->mddev->external) |
2201 | /* Must set offset before size, so overlap checks | 2202 | /* Must set offset before size, so overlap checks |
2202 | * can be sane */ | 2203 | * can be sane */ |
2203 | return -EBUSY; | 2204 | return -EBUSY; |
@@ -2211,7 +2212,7 @@ __ATTR(offset, S_IRUGO|S_IWUSR, offset_show, offset_store); | |||
2211 | static ssize_t | 2212 | static ssize_t |
2212 | rdev_size_show(mdk_rdev_t *rdev, char *page) | 2213 | rdev_size_show(mdk_rdev_t *rdev, char *page) |
2213 | { | 2214 | { |
2214 | return sprintf(page, "%llu\n", (unsigned long long)rdev->size); | 2215 | return sprintf(page, "%llu\n", (unsigned long long)rdev->sectors / 2); |
2215 | } | 2216 | } |
2216 | 2217 | ||
2217 | static int overlaps(sector_t s1, sector_t l1, sector_t s2, sector_t l2) | 2218 | static int overlaps(sector_t s1, sector_t l1, sector_t s2, sector_t l2) |
@@ -2227,31 +2228,31 @@ static int overlaps(sector_t s1, sector_t l1, sector_t s2, sector_t l2) | |||
2227 | static ssize_t | 2228 | static ssize_t |
2228 | rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | 2229 | rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) |
2229 | { | 2230 | { |
2230 | unsigned long long size; | ||
2231 | unsigned long long oldsize = rdev->size; | ||
2232 | mddev_t *my_mddev = rdev->mddev; | 2231 | mddev_t *my_mddev = rdev->mddev; |
2232 | sector_t oldsectors = rdev->sectors; | ||
2233 | unsigned long long sectors; | ||
2233 | 2234 | ||
2234 | if (strict_strtoull(buf, 10, &size) < 0) | 2235 | if (strict_strtoull(buf, 10, §ors) < 0) |
2235 | return -EINVAL; | 2236 | return -EINVAL; |
2237 | sectors *= 2; | ||
2236 | if (my_mddev->pers && rdev->raid_disk >= 0) { | 2238 | if (my_mddev->pers && rdev->raid_disk >= 0) { |
2237 | if (my_mddev->persistent) { | 2239 | if (my_mddev->persistent) { |
2238 | size = super_types[my_mddev->major_version]. | 2240 | sectors = super_types[my_mddev->major_version]. |
2239 | rdev_size_change(rdev, size * 2); | 2241 | rdev_size_change(rdev, sectors); |
2240 | if (!size) | 2242 | if (!sectors) |
2241 | return -EBUSY; | 2243 | return -EBUSY; |
2242 | } else if (!size) { | 2244 | } else if (!sectors) |
2243 | size = (rdev->bdev->bd_inode->i_size >> 10); | 2245 | sectors = (rdev->bdev->bd_inode->i_size >> 9) - |
2244 | size -= rdev->data_offset/2; | 2246 | rdev->data_offset; |
2245 | } | ||
2246 | } | 2247 | } |
2247 | if (size < my_mddev->dev_sectors / 2) | 2248 | if (sectors < my_mddev->dev_sectors) |
2248 | return -EINVAL; /* component must fit device */ | 2249 | return -EINVAL; /* component must fit device */ |
2249 | 2250 | ||
2250 | rdev->size = size; | 2251 | rdev->sectors = sectors; |
2251 | if (size > oldsize && my_mddev->external) { | 2252 | if (sectors > oldsectors && my_mddev->external) { |
2252 | /* need to check that all other rdevs with the same ->bdev | 2253 | /* need to check that all other rdevs with the same ->bdev |
2253 | * do not overlap. We need to unlock the mddev to avoid | 2254 | * do not overlap. We need to unlock the mddev to avoid |
2254 | * a deadlock. We have already changed rdev->size, and if | 2255 | * a deadlock. We have already changed rdev->sectors, and if |
2255 | * we have to change it back, we will have the lock again. | 2256 | * we have to change it back, we will have the lock again. |
2256 | */ | 2257 | */ |
2257 | mddev_t *mddev; | 2258 | mddev_t *mddev; |
@@ -2267,9 +2268,9 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2267 | if (test_bit(AllReserved, &rdev2->flags) || | 2268 | if (test_bit(AllReserved, &rdev2->flags) || |
2268 | (rdev->bdev == rdev2->bdev && | 2269 | (rdev->bdev == rdev2->bdev && |
2269 | rdev != rdev2 && | 2270 | rdev != rdev2 && |
2270 | overlaps(rdev->data_offset, rdev->size * 2, | 2271 | overlaps(rdev->data_offset, rdev->sectors, |
2271 | rdev2->data_offset, | 2272 | rdev2->data_offset, |
2272 | rdev2->size * 2))) { | 2273 | rdev2->sectors))) { |
2273 | overlap = 1; | 2274 | overlap = 1; |
2274 | break; | 2275 | break; |
2275 | } | 2276 | } |
@@ -2283,11 +2284,11 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2283 | if (overlap) { | 2284 | if (overlap) { |
2284 | /* Someone else could have slipped in a size | 2285 | /* Someone else could have slipped in a size |
2285 | * change here, but doing so is just silly. | 2286 | * change here, but doing so is just silly. |
2286 | * We put oldsize back because we *know* it is | 2287 | * We put oldsectors back because we *know* it is |
2287 | * safe, and trust userspace not to race with | 2288 | * safe, and trust userspace not to race with |
2288 | * itself | 2289 | * itself |
2289 | */ | 2290 | */ |
2290 | rdev->size = oldsize; | 2291 | rdev->sectors = oldsectors; |
2291 | return -EBUSY; | 2292 | return -EBUSY; |
2292 | } | 2293 | } |
2293 | } | 2294 | } |
@@ -3760,13 +3761,13 @@ static int do_md_run(mddev_t * mddev) | |||
3760 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 3761 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
3761 | if (test_bit(Faulty, &rdev->flags)) | 3762 | if (test_bit(Faulty, &rdev->flags)) |
3762 | continue; | 3763 | continue; |
3763 | if (rdev->size < chunk_size / 1024) { | 3764 | if (rdev->sectors < chunk_size / 512) { |
3764 | printk(KERN_WARNING | 3765 | printk(KERN_WARNING |
3765 | "md: Dev %s smaller than chunk_size:" | 3766 | "md: Dev %s smaller than chunk_size:" |
3766 | " %lluk < %dk\n", | 3767 | " %llu < %d\n", |
3767 | bdevname(rdev->bdev,b), | 3768 | bdevname(rdev->bdev,b), |
3768 | (unsigned long long)rdev->size, | 3769 | (unsigned long long)rdev->sectors, |
3769 | chunk_size / 1024); | 3770 | chunk_size / 512); |
3770 | return -EINVAL; | 3771 | return -EINVAL; |
3771 | } | 3772 | } |
3772 | } | 3773 | } |
@@ -4585,7 +4586,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
4585 | rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; | 4586 | rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; |
4586 | } else | 4587 | } else |
4587 | rdev->sb_start = calc_dev_sboffset(rdev->bdev); | 4588 | rdev->sb_start = calc_dev_sboffset(rdev->bdev); |
4588 | rdev->size = calc_num_sectors(rdev, mddev->chunk_size) / 2; | 4589 | rdev->sectors = calc_num_sectors(rdev, mddev->chunk_size); |
4589 | 4590 | ||
4590 | err = bind_rdev_to_array(rdev, mddev); | 4591 | err = bind_rdev_to_array(rdev, mddev); |
4591 | if (err) { | 4592 | if (err) { |
@@ -4655,7 +4656,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) | |||
4655 | else | 4656 | else |
4656 | rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; | 4657 | rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; |
4657 | 4658 | ||
4658 | rdev->size = calc_num_sectors(rdev, mddev->chunk_size) / 2; | 4659 | rdev->sectors = calc_num_sectors(rdev, mddev->chunk_size); |
4659 | 4660 | ||
4660 | if (test_bit(Faulty, &rdev->flags)) { | 4661 | if (test_bit(Faulty, &rdev->flags)) { |
4661 | printk(KERN_WARNING | 4662 | printk(KERN_WARNING |
@@ -4856,8 +4857,7 @@ static int update_size(mddev_t *mddev, sector_t num_sectors) | |||
4856 | */ | 4857 | */ |
4857 | return -EBUSY; | 4858 | return -EBUSY; |
4858 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 4859 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
4859 | sector_t avail; | 4860 | sector_t avail = rdev->sectors; |
4860 | avail = rdev->size * 2; | ||
4861 | 4861 | ||
4862 | if (fit && (num_sectors == 0 || num_sectors > avail)) | 4862 | if (fit && (num_sectors == 0 || num_sectors > avail)) |
4863 | num_sectors = avail; | 4863 | num_sectors = avail; |
@@ -5585,7 +5585,7 @@ struct mdstat_info { | |||
5585 | static int md_seq_show(struct seq_file *seq, void *v) | 5585 | static int md_seq_show(struct seq_file *seq, void *v) |
5586 | { | 5586 | { |
5587 | mddev_t *mddev = v; | 5587 | mddev_t *mddev = v; |
5588 | sector_t size; | 5588 | sector_t sectors; |
5589 | mdk_rdev_t *rdev; | 5589 | mdk_rdev_t *rdev; |
5590 | struct mdstat_info *mi = seq->private; | 5590 | struct mdstat_info *mi = seq->private; |
5591 | struct bitmap *bitmap; | 5591 | struct bitmap *bitmap; |
@@ -5621,7 +5621,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
5621 | seq_printf(seq, " %s", mddev->pers->name); | 5621 | seq_printf(seq, " %s", mddev->pers->name); |
5622 | } | 5622 | } |
5623 | 5623 | ||
5624 | size = 0; | 5624 | sectors = 0; |
5625 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 5625 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
5626 | char b[BDEVNAME_SIZE]; | 5626 | char b[BDEVNAME_SIZE]; |
5627 | seq_printf(seq, " %s[%d]", | 5627 | seq_printf(seq, " %s[%d]", |
@@ -5633,7 +5633,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
5633 | continue; | 5633 | continue; |
5634 | } else if (rdev->raid_disk < 0) | 5634 | } else if (rdev->raid_disk < 0) |
5635 | seq_printf(seq, "(S)"); /* spare */ | 5635 | seq_printf(seq, "(S)"); /* spare */ |
5636 | size += rdev->size; | 5636 | sectors += rdev->sectors; |
5637 | } | 5637 | } |
5638 | 5638 | ||
5639 | if (!list_empty(&mddev->disks)) { | 5639 | if (!list_empty(&mddev->disks)) { |
@@ -5643,7 +5643,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
5643 | mddev->array_sectors / 2); | 5643 | mddev->array_sectors / 2); |
5644 | else | 5644 | else |
5645 | seq_printf(seq, "\n %llu blocks", | 5645 | seq_printf(seq, "\n %llu blocks", |
5646 | (unsigned long long)size); | 5646 | (unsigned long long)sectors / 2); |
5647 | } | 5647 | } |
5648 | if (mddev->persistent) { | 5648 | if (mddev->persistent) { |
5649 | if (mddev->major_version != 0 || | 5649 | if (mddev->major_version != 0 || |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 946121236235..c07ea9118063 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -36,7 +36,7 @@ struct mdk_rdev_s | |||
36 | { | 36 | { |
37 | struct list_head same_set; /* RAID devices within the same set */ | 37 | struct list_head same_set; /* RAID devices within the same set */ |
38 | 38 | ||
39 | sector_t size; /* Device size (in blocks) */ | 39 | sector_t sectors; /* Device size (in 512bytes sectors) */ |
40 | mddev_t *mddev; /* RAID array if running */ | 40 | mddev_t *mddev; /* RAID array if running */ |
41 | int last_events; /* IO event timestamp */ | 41 | int last_events; /* IO event timestamp */ |
42 | 42 | ||
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 3d06df86da87..9aebb4c93b60 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -76,16 +76,15 @@ static int create_strip_zones (mddev_t *mddev) | |||
76 | list_for_each_entry(rdev2, &mddev->disks, same_set) { | 76 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
77 | printk(KERN_INFO "raid0: comparing %s(%llu)", | 77 | printk(KERN_INFO "raid0: comparing %s(%llu)", |
78 | bdevname(rdev1->bdev,b), | 78 | bdevname(rdev1->bdev,b), |
79 | (unsigned long long)rdev1->size); | 79 | (unsigned long long)rdev1->sectors); |
80 | printk(KERN_INFO " with %s(%llu)\n", | 80 | printk(KERN_INFO " with %s(%llu)\n", |
81 | bdevname(rdev2->bdev,b), | 81 | bdevname(rdev2->bdev,b), |
82 | (unsigned long long)rdev2->size); | 82 | (unsigned long long)rdev2->sectors); |
83 | if (rdev2 == rdev1) { | 83 | if (rdev2 == rdev1) { |
84 | printk(KERN_INFO "raid0: END\n"); | 84 | printk(KERN_INFO "raid0: END\n"); |
85 | break; | 85 | break; |
86 | } | 86 | } |
87 | if (rdev2->size == rdev1->size) | 87 | if (rdev2->sectors == rdev1->sectors) { |
88 | { | ||
89 | /* | 88 | /* |
90 | * Not unique, don't count it as a new | 89 | * Not unique, don't count it as a new |
91 | * group | 90 | * group |
@@ -148,7 +147,7 @@ static int create_strip_zones (mddev_t *mddev) | |||
148 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) | 147 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) |
149 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 148 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); |
150 | 149 | ||
151 | if (!smallest || (rdev1->size <smallest->size)) | 150 | if (!smallest || (rdev1->sectors < smallest->sectors)) |
152 | smallest = rdev1; | 151 | smallest = rdev1; |
153 | cnt++; | 152 | cnt++; |
154 | } | 153 | } |
@@ -158,10 +157,10 @@ static int create_strip_zones (mddev_t *mddev) | |||
158 | goto abort; | 157 | goto abort; |
159 | } | 158 | } |
160 | zone->nb_dev = cnt; | 159 | zone->nb_dev = cnt; |
161 | zone->sectors = smallest->size * cnt * 2; | 160 | zone->sectors = smallest->sectors * cnt; |
162 | zone->zone_start = 0; | 161 | zone->zone_start = 0; |
163 | 162 | ||
164 | current_start = smallest->size * 2; | 163 | current_start = smallest->sectors; |
165 | curr_zone_start = zone->sectors; | 164 | curr_zone_start = zone->sectors; |
166 | 165 | ||
167 | /* now do the other zones */ | 166 | /* now do the other zones */ |
@@ -180,29 +179,29 @@ static int create_strip_zones (mddev_t *mddev) | |||
180 | rdev = conf->strip_zone[0].dev[j]; | 179 | rdev = conf->strip_zone[0].dev[j]; |
181 | printk(KERN_INFO "raid0: checking %s ...", | 180 | printk(KERN_INFO "raid0: checking %s ...", |
182 | bdevname(rdev->bdev, b)); | 181 | bdevname(rdev->bdev, b)); |
183 | if (rdev->size > current_start / 2) { | 182 | if (rdev->sectors <= current_start) { |
184 | printk(KERN_INFO " contained as device %d\n", | ||
185 | c); | ||
186 | zone->dev[c] = rdev; | ||
187 | c++; | ||
188 | if (!smallest || (rdev->size <smallest->size)) { | ||
189 | smallest = rdev; | ||
190 | printk(KERN_INFO " (%llu) is smallest!.\n", | ||
191 | (unsigned long long)rdev->size); | ||
192 | } | ||
193 | } else | ||
194 | printk(KERN_INFO " nope.\n"); | 183 | printk(KERN_INFO " nope.\n"); |
184 | continue; | ||
185 | } | ||
186 | printk(KERN_INFO " contained as device %d\n", c); | ||
187 | zone->dev[c] = rdev; | ||
188 | c++; | ||
189 | if (!smallest || rdev->sectors < smallest->sectors) { | ||
190 | smallest = rdev; | ||
191 | printk(KERN_INFO " (%llu) is smallest!.\n", | ||
192 | (unsigned long long)rdev->sectors); | ||
193 | } | ||
195 | } | 194 | } |
196 | 195 | ||
197 | zone->nb_dev = c; | 196 | zone->nb_dev = c; |
198 | zone->sectors = (smallest->size * 2 - current_start) * c; | 197 | zone->sectors = (smallest->sectors - current_start) * c; |
199 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", | 198 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", |
200 | zone->nb_dev, (unsigned long long)zone->sectors); | 199 | zone->nb_dev, (unsigned long long)zone->sectors); |
201 | 200 | ||
202 | zone->zone_start = curr_zone_start; | 201 | zone->zone_start = curr_zone_start; |
203 | curr_zone_start += zone->sectors; | 202 | curr_zone_start += zone->sectors; |
204 | 203 | ||
205 | current_start = smallest->size * 2; | 204 | current_start = smallest->sectors; |
206 | printk(KERN_INFO "raid0: current zone start: %llu\n", | 205 | printk(KERN_INFO "raid0: current zone start: %llu\n", |
207 | (unsigned long long)current_start); | 206 | (unsigned long long)current_start); |
208 | } | 207 | } |
@@ -296,7 +295,7 @@ static int raid0_run (mddev_t *mddev) | |||
296 | /* calculate array device size */ | 295 | /* calculate array device size */ |
297 | mddev->array_sectors = 0; | 296 | mddev->array_sectors = 0; |
298 | list_for_each_entry(rdev, &mddev->disks, same_set) | 297 | list_for_each_entry(rdev, &mddev->disks, same_set) |
299 | mddev->array_sectors += rdev->size * 2; | 298 | mddev->array_sectors += rdev->sectors; |
300 | 299 | ||
301 | printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", | 300 | printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", |
302 | (unsigned long long)mddev->array_sectors); | 301 | (unsigned long long)mddev->array_sectors); |