rnbd: use set_capacity_and_notify
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Nov 2020 14:57:08 +0000 (15:57 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Nov 2020 15:34:14 +0000 (08:34 -0700)
Use set_capacity_and_notify to set the size of both the disk and block
device.  This also gets the uevent notifications for the resize for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rnbd/rnbd-clt.c

index 8b2411c..bb13d7d 100644 (file)
@@ -100,8 +100,7 @@ static int rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
        rnbd_clt_info(dev, "Device size changed from %zu to %zu sectors\n",
                       dev->nsectors, new_nsectors);
        dev->nsectors = new_nsectors;
-       set_capacity(dev->gd, dev->nsectors);
-       revalidate_disk_size(dev->gd, true);
+       set_capacity_and_notify(dev->gd, dev->nsectors);
        return 0;
 }