dm: use set_capacity_and_notify
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Nov 2020 14:57:03 +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>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/dm.c

index 6db395c..54739f1 100644 (file)
@@ -1974,8 +1974,7 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
        if (size != dm_get_size(md))
                memset(&md->geometry, 0, sizeof(md->geometry));
 
-       set_capacity(md->disk, size);
-       bd_set_nr_sectors(md->bdev, size);
+       set_capacity_and_notify(md->disk, size);
 
        dm_table_event_callback(t, event_callback, md);