diff options
author | Andre Noll <maan@systemlinux.org> | 2008-07-11 12:02:23 (GMT) |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-07-11 12:02:23 (GMT) |
commit | b73df2d3d629aefa187a0a3574fd81455e026bc8 (patch) | |
tree | 87e2a32c602c99cf69c298d3ed6e145a6202b481 /drivers/md | |
parent | e7debaa4951b37d6c9ace4c6b984cd4805c5bfbb (diff) | |
download | linux-b73df2d3d629aefa187a0a3574fd81455e026bc8.tar.xz |
md: Make calc_dev_sboffset() return a sector count.
As BLOCK_SIZE_BITS is 10 and
MD_NEW_SIZE_SECTORS(2 * x) = 2 * NEW_SIZE_BLOCKS(x),
the return value of calc_dev_sboffset() doubles. Fix up all three
callers accordingly.
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.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 19f646a..3276edd 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -347,10 +347,11 @@ static struct mdk_personality *find_pers(int level, char *clevel) return NULL; } +/* return the offset of the super block in 512byte sectors */ static inline sector_t calc_dev_sboffset(struct block_device *bdev) { - sector_t size = bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; - return MD_NEW_SIZE_BLOCKS(size); + sector_t num_sectors = bdev->bd_inode->i_size / 512; + return MD_NEW_SIZE_SECTORS(num_sectors); } static sector_t calc_num_sectors(mdk_rdev_t *rdev, unsigned chunk_size) @@ -673,7 +674,7 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version * * It also happens to be a multiple of 4Kb. */ - sb_offset = calc_dev_sboffset(rdev->bdev); + sb_offset = calc_dev_sboffset(rdev->bdev) / 2; rdev->sb_offset = sb_offset; ret = read_disk_sb(rdev, MD_SB_BYTES); @@ -1006,7 +1007,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, unsigned long long size) size *= 2; /* convert to sectors */ if (rdev->mddev->bitmap_offset) return 0; /* can't move bitmap */ - rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + rdev->sb_offset = calc_dev_sboffset(rdev->bdev) / 2; if (!size || size > rdev->sb_offset*2) size = rdev->sb_offset*2; md_super_write(rdev->mddev, rdev, rdev->sb_offset << 1, rdev->sb_size, @@ -4356,7 +4357,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) printk(KERN_INFO "md: nonpersistent superblock ...\n"); rdev->sb_offset = rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; } else - rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + rdev->sb_offset = calc_dev_sboffset(rdev->bdev) / 2; rdev->size = calc_num_sectors(rdev, mddev->chunk_size) / 2; err = bind_rdev_to_array(rdev, mddev); @@ -4423,7 +4424,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) } if (mddev->persistent) - rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + rdev->sb_offset = calc_dev_sboffset(rdev->bdev) / 2; else rdev->sb_offset = rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; |