diff options
-rw-r--r-- | drivers/md/dm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f0cd8ea327d3..88f1f27526cc 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -825,18 +825,13 @@ static void event_callback(void *context) | |||
825 | wake_up(&md->eventq); | 825 | wake_up(&md->eventq); |
826 | } | 826 | } |
827 | 827 | ||
828 | static void __set_size(struct gendisk *disk, sector_t size) | 828 | static void __set_size(struct mapped_device *md, sector_t size) |
829 | { | 829 | { |
830 | struct block_device *bdev; | 830 | set_capacity(md->disk, size); |
831 | 831 | ||
832 | set_capacity(disk, size); | 832 | down(&md->frozen_bdev->bd_inode->i_sem); |
833 | bdev = bdget_disk(disk, 0); | 833 | i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
834 | if (bdev) { | 834 | up(&md->frozen_bdev->bd_inode->i_sem); |
835 | down(&bdev->bd_inode->i_sem); | ||
836 | i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | ||
837 | up(&bdev->bd_inode->i_sem); | ||
838 | bdput(bdev); | ||
839 | } | ||
840 | } | 835 | } |
841 | 836 | ||
842 | static int __bind(struct mapped_device *md, struct dm_table *t) | 837 | static int __bind(struct mapped_device *md, struct dm_table *t) |
@@ -845,7 +840,7 @@ static int __bind(struct mapped_device *md, struct dm_table *t) | |||
845 | sector_t size; | 840 | sector_t size; |
846 | 841 | ||
847 | size = dm_table_get_size(t); | 842 | size = dm_table_get_size(t); |
848 | __set_size(md->disk, size); | 843 | __set_size(md, size); |
849 | if (size == 0) | 844 | if (size == 0) |
850 | return 0; | 845 | return 0; |
851 | 846 | ||