aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-08-02 20:59:58 -0400
committerNeilBrown <neilb@suse.de>2009-08-02 20:59:58 -0400
commit449aad3e25358812c43afc60918c5ad3819488e7 (patch)
tree45fab3b82fc1ed06959537a0801319045cf4c102 /drivers/md/md.c
parent64bd660b51b2da92e99a5e97349f6558349f11c5 (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/md.c')
-rw-r--r--drivers/md/md.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 52c988b072d0..5b98bea4ff9b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3741,17 +3741,8 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len)
3741 3741
3742 mddev->array_sectors = sectors; 3742 mddev->array_sectors = sectors;
3743 set_capacity(mddev->gendisk, mddev->array_sectors); 3743 set_capacity(mddev->gendisk, mddev->array_sectors);
3744 if (mddev->pers) { 3744 if (mddev->pers)
3745 struct block_device *bdev = bdget_disk(mddev->gendisk, 0); 3745 revalidate_disk(mddev->gendisk);
3746
3747 if (bdev) {
3748 mutex_lock(&bdev->bd_inode->i_mutex);
3749 i_size_write(bdev->bd_inode,
3750 (loff_t)mddev->array_sectors << 9);
3751 mutex_unlock(&bdev->bd_inode->i_mutex);
3752 bdput(bdev);
3753 }
3754 }
3755 3746
3756 return len; 3747 return len;
3757} 3748}
@@ -4241,6 +4232,7 @@ static int do_md_run(mddev_t * mddev)
4241 md_wakeup_thread(mddev->thread); 4232 md_wakeup_thread(mddev->thread);
4242 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ 4233 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
4243 4234
4235 revalidate_disk(mddev->gendisk);
4244 mddev->changed = 1; 4236 mddev->changed = 1;
4245 md_new_event(mddev); 4237 md_new_event(mddev);
4246 sysfs_notify_dirent(mddev->sysfs_state); 4238 sysfs_notify_dirent(mddev->sysfs_state);
@@ -5139,18 +5131,8 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
5139 return -ENOSPC; 5131 return -ENOSPC;
5140 } 5132 }
5141 rv = mddev->pers->resize(mddev, num_sectors); 5133 rv = mddev->pers->resize(mddev, num_sectors);
5142 if (!rv) { 5134 if (!rv)
5143 struct block_device *bdev; 5135 revalidate_disk(mddev->gendisk);
5144
5145 bdev = bdget_disk(mddev->gendisk, 0);
5146 if (bdev) {
5147 mutex_lock(&bdev->bd_inode->i_mutex);
5148 i_size_write(bdev->bd_inode,
5149 (loff_t)mddev->array_sectors << 9);
5150 mutex_unlock(&bdev->bd_inode->i_mutex);
5151 bdput(bdev);
5152 }
5153 }
5154 return rv; 5136 return rv;
5155} 5137}
5156 5138