[RFC PATCH 2/5] drivers/block/virtio_blk.c: Convert to use disk_set_capacity

From: Balbir Singh
Date: Sun Dec 22 2019 - 20:41:36 EST


block/genhd provides disk_set_capacity() for sending
RESIZE notifications via uevents.

Signed-off-by: Balbir Singh <sblbir@xxxxxxxxxx>
---
drivers/block/virtio_blk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index fbbf18ac1d5d..9848c94a7eb4 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -479,18 +479,16 @@ static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
cap_str_10,
cap_str_2);

- set_capacity(vblk->disk, capacity);
+ disk_set_capacity(vblk->disk, capacity);
}

static void virtblk_config_changed_work(struct work_struct *work)
{
struct virtio_blk *vblk =
container_of(work, struct virtio_blk, config_work);
- char *envp[] = { "RESIZE=1", NULL };

virtblk_update_capacity(vblk, true);
revalidate_disk(vblk->disk);
- kobject_uevent_env(&disk_to_dev(vblk->disk)->kobj, KOBJ_CHANGE, envp);
}

static void virtblk_config_changed(struct virtio_device *vdev)
--
2.16.5