summaryrefslogtreecommitdiffstats
path: root/block/bdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/bdev.c')
-rw-r--r--block/bdev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/bdev.c b/block/bdev.c
index 850852fe4b78..717089a5726f 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -428,6 +428,14 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
return bdev;
}
+void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors)
+{
+ spin_lock(&bdev->bd_size_lock);
+ i_size_write(bdev->bd_inode, (loff_t)sectors << SECTOR_SHIFT);
+ bdev->bd_nr_sectors = sectors;
+ spin_unlock(&bdev->bd_size_lock);
+}
+
void bdev_add(struct block_device *bdev, dev_t dev)
{
bdev->bd_dev = dev;