list_for_each_entry(rdev, &mddev->disks, same_set)
conf->rdev = rdev;
- mddev->array_sectors = faulty_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
mddev->private = conf;
reconfig(mddev, mddev->layout, -1);
if (!conf)
return 1;
mddev->private = conf;
- mddev->array_sectors = linear_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
mddev->queue->unplug_fn = linear_unplug;
newconf->prev = mddev_to_conf(mddev);
mddev->private = newconf;
mddev->raid_disks++;
- mddev->array_sectors = linear_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
set_capacity(mddev->gendisk, mddev->array_sectors);
return 0;
}
return 0;
}
+void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors)
+{
+ mddev->array_sectors = array_sectors;
+}
+EXPORT_SYMBOL(md_set_array_sectors);
+
static int update_size(mddev_t *mddev, sector_t num_sectors)
{
mdk_rdev_t *rdev;
extern void md_new_event(mddev_t *mddev);
extern int md_allow_write(mddev_t *mddev);
extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
+extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
/*
* Ok, everything is just fine now
*/
- mddev->array_sectors = multipath_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, multipath_size(mddev, 0, 0));
mddev->queue->unplug_fn = multipath_unplug;
mddev->queue->backing_dev_info.congested_fn = multipath_congested;
goto out_free_conf;
/* calculate array device size */
- mddev->array_sectors = raid0_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));
printk(KERN_INFO "raid0 : md_size is %llu sectors.\n",
(unsigned long long)mddev->array_sectors);
/*
* Ok, everything is just fine now
*/
- mddev->array_sectors = raid1_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
mddev->queue->unplug_fn = raid1_unplug;
mddev->queue->backing_dev_info.congested_fn = raid1_congested;
* any io in the removed space completes, but it hardly seems
* worth it.
*/
- mddev->array_sectors = raid1_size(mddev, sectors, 0);
+ md_set_array_sectors(mddev, raid1_size(mddev, sectors, 0));
set_capacity(mddev->gendisk, mddev->array_sectors);
mddev->changed = 1;
if (mddev->array_sectors > mddev->dev_sectors &&
/*
* Ok, everything is just fine now
*/
- mddev->array_sectors = raid10_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, raid10_size(mddev, 0, 0));
mddev->resync_max_sectors = mddev->array_sectors;
mddev->queue->unplug_fn = raid10_unplug;
mddev->queue->backing_dev_info.congested_data = mddev;
mddev->queue->backing_dev_info.congested_fn = raid5_congested;
- mddev->array_sectors = raid5_size(mddev, 0, 0);
+ md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
* worth it.
*/
sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
- mddev->array_sectors = raid5_size(mddev, sectors, mddev->raid_disks);
+ md_set_array_sectors(mddev, raid5_size(mddev, sectors,
+ mddev->raid_disks));
set_capacity(mddev->gendisk, mddev->array_sectors);
mddev->changed = 1;
if (sectors > mddev->dev_sectors && mddev->recovery_cp == MaxSector) {
if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
mddev_t *mddev = conf->mddev;
- mddev->array_sectors = raid5_size(mddev, 0, conf->raid_disks);
+ md_set_array_sectors(mddev, raid5_size(mddev, 0,
+ conf->raid_disks));
set_capacity(mddev->gendisk, mddev->array_sectors);
mddev->changed = 1;
conf->previous_raid_disks = conf->raid_disks;