diff options
author | NeilBrown <neilb@suse.de> | 2009-08-02 20:59:58 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-08-02 20:59:58 -0400 |
commit | 449aad3e25358812c43afc60918c5ad3819488e7 (patch) | |
tree | 45fab3b82fc1ed06959537a0801319045cf4c102 /drivers/md/raid5.c | |
parent | 64bd660b51b2da92e99a5e97349f6558349f11c5 (diff) |
md: Use revalidate_disk to effect changes in size of device.
As revalidate_disk calls check_disk_size_change, it will cause
any capacity change of a gendisk to be propagated to the blockdev
inode. So use that instead of mucking about with locks and
i_size_write.
Also add a call to revalidate_disk in do_md_run and a few other places
where the gendisk capacity is changed.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2dc35b4c20ac..2b521ee67dfa 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4858,6 +4858,7 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors) | |||
4858 | return -EINVAL; | 4858 | return -EINVAL; |
4859 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4859 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4860 | mddev->changed = 1; | 4860 | mddev->changed = 1; |
4861 | revalidate_disk(mddev->gendisk); | ||
4861 | if (sectors > mddev->dev_sectors && mddev->recovery_cp == MaxSector) { | 4862 | if (sectors > mddev->dev_sectors && mddev->recovery_cp == MaxSector) { |
4862 | mddev->recovery_cp = mddev->dev_sectors; | 4863 | mddev->recovery_cp = mddev->dev_sectors; |
4863 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 4864 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
@@ -5058,7 +5059,6 @@ static void end_reshape(raid5_conf_t *conf) | |||
5058 | */ | 5059 | */ |
5059 | static void raid5_finish_reshape(mddev_t *mddev) | 5060 | static void raid5_finish_reshape(mddev_t *mddev) |
5060 | { | 5061 | { |
5061 | struct block_device *bdev; | ||
5062 | raid5_conf_t *conf = mddev->private; | 5062 | raid5_conf_t *conf = mddev->private; |
5063 | 5063 | ||
5064 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 5064 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
@@ -5067,15 +5067,7 @@ static void raid5_finish_reshape(mddev_t *mddev) | |||
5067 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); | 5067 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); |
5068 | set_capacity(mddev->gendisk, mddev->array_sectors); | 5068 | set_capacity(mddev->gendisk, mddev->array_sectors); |
5069 | mddev->changed = 1; | 5069 | mddev->changed = 1; |
5070 | 5070 | revalidate_disk(mddev->gendisk); | |
5071 | bdev = bdget_disk(mddev->gendisk, 0); | ||
5072 | if (bdev) { | ||
5073 | mutex_lock(&bdev->bd_inode->i_mutex); | ||
5074 | i_size_write(bdev->bd_inode, | ||
5075 | (loff_t)mddev->array_sectors << 9); | ||
5076 | mutex_unlock(&bdev->bd_inode->i_mutex); | ||
5077 | bdput(bdev); | ||
5078 | } | ||
5079 | } else { | 5071 | } else { |
5080 | int d; | 5072 | int d; |
5081 | mddev->degraded = conf->raid_disks; | 5073 | mddev->degraded = conf->raid_disks; |