mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-16 05:50:19 +00:00
md: Make mddev->array_size sector-based.
This patch renames the array_size field of struct mddev_s to array_sectors and converts all instances to use units of 512 byte sectors instead of 1k blocks. Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
15f4a5fdf3
commit
f233ea5c9e
@ -297,7 +297,7 @@ static int run(mddev_t *mddev)
|
||||
rdev_for_each(rdev, tmp, mddev)
|
||||
conf->rdev = rdev;
|
||||
|
||||
mddev->array_size = mddev->size;
|
||||
mddev->array_sectors = mddev->size * 2;
|
||||
mddev->private = conf;
|
||||
|
||||
reconfig(mddev, mddev->layout, -1);
|
||||
|
@ -256,7 +256,7 @@ static int linear_run (mddev_t *mddev)
|
||||
if (!conf)
|
||||
return 1;
|
||||
mddev->private = conf;
|
||||
mddev->array_size = conf->array_size;
|
||||
mddev->array_sectors = conf->array_size * 2;
|
||||
|
||||
blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
|
||||
mddev->queue->unplug_fn = linear_unplug;
|
||||
@ -290,8 +290,8 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
|
||||
newconf->prev = mddev_to_conf(mddev);
|
||||
mddev->private = newconf;
|
||||
mddev->raid_disks++;
|
||||
mddev->array_size = newconf->array_size;
|
||||
set_capacity(mddev->gendisk, mddev->array_size << 1);
|
||||
mddev->array_sectors = newconf->array_size * 2;
|
||||
set_capacity(mddev->gendisk, mddev->array_sectors);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3704,7 +3704,7 @@ static int do_md_run(mddev_t * mddev)
|
||||
if (mddev->flags)
|
||||
md_update_sb(mddev, 0);
|
||||
|
||||
set_capacity(disk, mddev->array_size<<1);
|
||||
set_capacity(disk, mddev->array_sectors);
|
||||
|
||||
/* If we call blk_queue_make_request here, it will
|
||||
* re-initialise max_sectors etc which may have been
|
||||
@ -3905,7 +3905,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
|
||||
|
||||
export_array(mddev);
|
||||
|
||||
mddev->array_size = 0;
|
||||
mddev->array_sectors = 0;
|
||||
mddev->size = 0;
|
||||
mddev->raid_disks = 0;
|
||||
mddev->recovery_cp = 0;
|
||||
@ -4644,7 +4644,8 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
|
||||
bdev = bdget_disk(mddev->gendisk, 0);
|
||||
if (bdev) {
|
||||
mutex_lock(&bdev->bd_inode->i_mutex);
|
||||
i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10);
|
||||
i_size_write(bdev->bd_inode,
|
||||
(loff_t)mddev->array_sectors << 9);
|
||||
mutex_unlock(&bdev->bd_inode->i_mutex);
|
||||
bdput(bdev);
|
||||
}
|
||||
@ -5391,10 +5392,11 @@ static int md_seq_show(struct seq_file *seq, void *v)
|
||||
if (!list_empty(&mddev->disks)) {
|
||||
if (mddev->pers)
|
||||
seq_printf(seq, "\n %llu blocks",
|
||||
(unsigned long long)mddev->array_size);
|
||||
(unsigned long long)
|
||||
mddev->array_sectors / 2);
|
||||
else
|
||||
seq_printf(seq, "\n %llu blocks",
|
||||
(unsigned long long)size);
|
||||
(unsigned long long)size);
|
||||
}
|
||||
if (mddev->persistent) {
|
||||
if (mddev->major_version != 0 ||
|
||||
|
@ -504,7 +504,7 @@ static int multipath_run (mddev_t *mddev)
|
||||
/*
|
||||
* Ok, everything is just fine now
|
||||
*/
|
||||
mddev->array_size = mddev->size;
|
||||
mddev->array_sectors = mddev->size * 2;
|
||||
|
||||
mddev->queue->unplug_fn = multipath_unplug;
|
||||
mddev->queue->backing_dev_info.congested_fn = multipath_congested;
|
||||
|
@ -293,16 +293,16 @@ static int raid0_run (mddev_t *mddev)
|
||||
goto out_free_conf;
|
||||
|
||||
/* calculate array device size */
|
||||
mddev->array_size = 0;
|
||||
mddev->array_sectors = 0;
|
||||
rdev_for_each(rdev, tmp, mddev)
|
||||
mddev->array_size += rdev->size;
|
||||
mddev->array_sectors += rdev->size * 2;
|
||||
|
||||
printk("raid0 : md_size is %llu blocks.\n",
|
||||
(unsigned long long)mddev->array_size);
|
||||
(unsigned long long)mddev->array_sectors / 2);
|
||||
printk("raid0 : conf->hash_spacing is %llu blocks.\n",
|
||||
(unsigned long long)conf->hash_spacing);
|
||||
{
|
||||
sector_t s = mddev->array_size;
|
||||
sector_t s = mddev->array_sectors / 2;
|
||||
sector_t space = conf->hash_spacing;
|
||||
int round;
|
||||
conf->preshift = 0;
|
||||
|
@ -2043,7 +2043,7 @@ static int run(mddev_t *mddev)
|
||||
/*
|
||||
* Ok, everything is just fine now
|
||||
*/
|
||||
mddev->array_size = mddev->size;
|
||||
mddev->array_sectors = mddev->size * 2;
|
||||
|
||||
mddev->queue->unplug_fn = raid1_unplug;
|
||||
mddev->queue->backing_dev_info.congested_fn = raid1_congested;
|
||||
@ -2105,14 +2105,15 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
|
||||
* any io in the removed space completes, but it hardly seems
|
||||
* worth it.
|
||||
*/
|
||||
mddev->array_size = sectors>>1;
|
||||
set_capacity(mddev->gendisk, mddev->array_size << 1);
|
||||
mddev->array_sectors = sectors;
|
||||
set_capacity(mddev->gendisk, mddev->array_sectors);
|
||||
mddev->changed = 1;
|
||||
if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) {
|
||||
if (mddev->array_sectors / 2 > mddev->size &&
|
||||
mddev->recovery_cp == MaxSector) {
|
||||
mddev->recovery_cp = mddev->size << 1;
|
||||
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
|
||||
}
|
||||
mddev->size = mddev->array_size;
|
||||
mddev->size = mddev->array_sectors / 2;
|
||||
mddev->resync_max_sectors = sectors;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2164,7 +2164,7 @@ static int run(mddev_t *mddev)
|
||||
/*
|
||||
* Ok, everything is just fine now
|
||||
*/
|
||||
mddev->array_size = size << (conf->chunk_shift-1);
|
||||
mddev->array_sectors = size << conf->chunk_shift;
|
||||
mddev->resync_max_sectors = size << conf->chunk_shift;
|
||||
|
||||
mddev->queue->unplug_fn = raid10_unplug;
|
||||
|
@ -3540,7 +3540,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
|
||||
j == raid6_next_disk(sh->pd_idx, sh->disks))
|
||||
continue;
|
||||
s = compute_blocknr(sh, j);
|
||||
if (s < (mddev->array_size<<1)) {
|
||||
if (s < mddev->array_sectors) {
|
||||
skipped = 1;
|
||||
continue;
|
||||
}
|
||||
@ -4189,7 +4189,7 @@ static int run(mddev_t *mddev)
|
||||
mddev->queue->backing_dev_info.congested_data = mddev;
|
||||
mddev->queue->backing_dev_info.congested_fn = raid5_congested;
|
||||
|
||||
mddev->array_size = mddev->size * (conf->previous_raid_disks -
|
||||
mddev->array_sectors = 2 * mddev->size * (conf->previous_raid_disks -
|
||||
conf->max_degraded);
|
||||
|
||||
blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
|
||||
@ -4413,8 +4413,9 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
|
||||
raid5_conf_t *conf = mddev_to_conf(mddev);
|
||||
|
||||
sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
|
||||
mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1;
|
||||
set_capacity(mddev->gendisk, mddev->array_size << 1);
|
||||
mddev->array_sectors = sectors * (mddev->raid_disks
|
||||
- conf->max_degraded);
|
||||
set_capacity(mddev->gendisk, mddev->array_sectors);
|
||||
mddev->changed = 1;
|
||||
if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) {
|
||||
mddev->recovery_cp = mddev->size << 1;
|
||||
@ -4547,15 +4548,16 @@ static void end_reshape(raid5_conf_t *conf)
|
||||
struct block_device *bdev;
|
||||
|
||||
if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
|
||||
conf->mddev->array_size = conf->mddev->size *
|
||||
conf->mddev->array_sectors = 2 * conf->mddev->size *
|
||||
(conf->raid_disks - conf->max_degraded);
|
||||
set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1);
|
||||
set_capacity(conf->mddev->gendisk, conf->mddev->array_sectors);
|
||||
conf->mddev->changed = 1;
|
||||
|
||||
bdev = bdget_disk(conf->mddev->gendisk, 0);
|
||||
if (bdev) {
|
||||
mutex_lock(&bdev->bd_inode->i_mutex);
|
||||
i_size_write(bdev->bd_inode, (loff_t)conf->mddev->array_size << 10);
|
||||
i_size_write(bdev->bd_inode,
|
||||
(loff_t)conf->mddev->array_sectors << 9);
|
||||
mutex_unlock(&bdev->bd_inode->i_mutex);
|
||||
bdput(bdev);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ struct mddev_s
|
||||
int raid_disks;
|
||||
int max_disks;
|
||||
sector_t size; /* used size of component devices */
|
||||
sector_t array_size; /* exported array size */
|
||||
sector_t array_sectors; /* exported array size */
|
||||
__u64 events;
|
||||
|
||||
char uuid[16];
|
||||
|
Loading…
Reference in New Issue
Block a user