aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2008-07-11 08:02:23 -0400
committerNeil Brown <neilb@suse.de>2008-07-11 08:02:23 -0400
commite7debaa4951b37d6c9ace4c6b984cd4805c5bfbb (patch)
tree9d61e2341af2161c0298c1396e6a85a1d4437eef /drivers/md
parentd71f9f88d74166dcdef743a057f9222d64d2d509 (diff)
md: Replace calc_dev_size() by calc_num_sectors().
Number of sectors is the preferred unit for sizes of raid devices, so change calc_dev_size() so that it returns this unit instead of the number of 1K blocks. Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 158c38f54a4..19f646a7640 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -353,15 +353,13 @@ static inline sector_t calc_dev_sboffset(struct block_device *bdev)
353 return MD_NEW_SIZE_BLOCKS(size); 353 return MD_NEW_SIZE_BLOCKS(size);
354} 354}
355 355
356static sector_t calc_dev_size(mdk_rdev_t *rdev, unsigned chunk_size) 356static sector_t calc_num_sectors(mdk_rdev_t *rdev, unsigned chunk_size)
357{ 357{
358 sector_t size; 358 sector_t num_sectors = rdev->sb_offset * 2;
359
360 size = rdev->sb_offset;
361 359
362 if (chunk_size) 360 if (chunk_size)
363 size &= ~((sector_t)chunk_size/1024 - 1); 361 num_sectors &= ~((sector_t)chunk_size/512 - 1);
364 return size; 362 return num_sectors;
365} 363}
366 364
367static int alloc_disk_sb(mdk_rdev_t * rdev) 365static int alloc_disk_sb(mdk_rdev_t * rdev)
@@ -753,7 +751,7 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
753 else 751 else
754 ret = 0; 752 ret = 0;
755 } 753 }
756 rdev->size = calc_dev_size(rdev, sb->chunk_size); 754 rdev->size = calc_num_sectors(rdev, sb->chunk_size) / 2;
757 755
758 if (rdev->size < sb->size && sb->level > 1) 756 if (rdev->size < sb->size && sb->level > 1)
759 /* "this cannot possibly happen" ... */ 757 /* "this cannot possibly happen" ... */
@@ -4359,7 +4357,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
4359 rdev->sb_offset = rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; 4357 rdev->sb_offset = rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;
4360 } else 4358 } else
4361 rdev->sb_offset = calc_dev_sboffset(rdev->bdev); 4359 rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
4362 rdev->size = calc_dev_size(rdev, mddev->chunk_size); 4360 rdev->size = calc_num_sectors(rdev, mddev->chunk_size) / 2;
4363 4361
4364 err = bind_rdev_to_array(rdev, mddev); 4362 err = bind_rdev_to_array(rdev, mddev);
4365 if (err) { 4363 if (err) {
@@ -4398,7 +4396,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
4398{ 4396{
4399 char b[BDEVNAME_SIZE]; 4397 char b[BDEVNAME_SIZE];
4400 int err; 4398 int err;
4401 unsigned int size;
4402 mdk_rdev_t *rdev; 4399 mdk_rdev_t *rdev;
4403 4400
4404 if (!mddev->pers) 4401 if (!mddev->pers)
@@ -4431,8 +4428,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
4431 rdev->sb_offset = 4428 rdev->sb_offset =
4432 rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; 4429 rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;
4433 4430
4434 size = calc_dev_size(rdev, mddev->chunk_size); 4431 rdev->size = calc_num_sectors(rdev, mddev->chunk_size) / 2;
4435 rdev->size = size;
4436 4432
4437 if (test_bit(Faulty, &rdev->flags)) { 4433 if (test_bit(Faulty, &rdev->flags)) {
4438 printk(KERN_WARNING 4434 printk(KERN_WARNING