[PATCH v4 4/5]nbd: use i_size_write to assign nbd device size
From: Pranay Kr. Srivastava
Date: Thu Jun 30 2016 - 07:02:37 EST
Signed-off-by: Pranay Kr. Srivastava <pranjas@xxxxxxxxx>
---
drivers/block/nbd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index fb56dd2..7126878 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -128,7 +128,7 @@ static const char *nbdcmd_to_ascii(int cmd)
static int nbd_size_clear(struct nbd_device *nbd, struct block_device *bdev)
{
- bdev->bd_inode->i_size = 0;
+ i_size_write(bdev->bd_inode, 0);
set_capacity(nbd->disk, 0);
kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
@@ -140,7 +140,7 @@ static void nbd_size_update(struct nbd_device *nbd, struct block_device *bdev)
if (!nbd_is_connected(nbd))
return;
- bdev->bd_inode->i_size = nbd->bytesize;
+ i_size_write(bdev->bd_inode, nbd->bytesize);
set_capacity(nbd->disk, nbd->bytesize >> 9);
kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
}
@@ -682,7 +682,7 @@ static void nbd_reset(struct nbd_device *nbd)
static void nbd_bdev_reset(struct block_device *bdev)
{
set_device_ro(bdev, false);
- bdev->bd_inode->i_size = 0;
+ i_size_write(bdev->bd_inode, 0);
if (max_part > 0) {
blkdev_reread_part(bdev);
bdev->bd_invalidated = 1;
--
1.9.1