summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-16 15:56:56 +0100
committerJens Axboe <axboe@kernel.dk>2020-11-16 08:34:14 -0700
commit449f4ec9892ebc2f37a7eae6d97db2cf7c65e09a (patch)
tree83d296e86fbbb838ba5c0e08cc152d3c688b3012
parentb200e38c493b2a5acff4f86d40a3e45d546c664c (diff)
downloadlinux-449f4ec9892ebc2f37a7eae6d97db2cf7c65e09a.tar.bz2
block: remove the update_bdev parameter to set_capacity_revalidate_and_notify
The update_bdev argument is always set to true, so remove it. Also rename the function to the slighly less verbose set_capacity_and_notify, as propagating the disk size to the block device isn't really revalidation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/genhd.c13
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/virtio_blk.c2
-rw-r--r--drivers/block/xen-blkfront.c2
-rw-r--r--drivers/nvme/host/core.c2
-rw-r--r--drivers/scsi/sd.c5
-rw-r--r--include/linux/genhd.h3
7 files changed, 12 insertions, 17 deletions
diff --git a/block/genhd.c b/block/genhd.c
index ec2a24799cd9..4e039524f92b 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -47,17 +47,15 @@ static void disk_del_events(struct gendisk *disk);
static void disk_release_events(struct gendisk *disk);
/*
- * Set disk capacity and notify if the size is not currently
- * zero and will not be set to zero
+ * Set disk capacity and notify if the size is not currently zero and will not
+ * be set to zero. Returns true if a uevent was sent, otherwise false.
*/
-bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
- bool update_bdev)
+bool set_capacity_and_notify(struct gendisk *disk, sector_t size)
{
sector_t capacity = get_capacity(disk);
set_capacity(disk, size);
- if (update_bdev)
- revalidate_disk_size(disk, true);
+ revalidate_disk_size(disk, true);
if (capacity != size && capacity != 0 && size != 0) {
char *envp[] = { "RESIZE=1", NULL };
@@ -68,8 +66,7 @@ bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
return false;
}
-
-EXPORT_SYMBOL_GPL(set_capacity_revalidate_and_notify);
+EXPORT_SYMBOL_GPL(set_capacity_and_notify);
/*
* Format the device name of the indicated disk into the supplied buffer and
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fcc5e32f0993..9a27d4f1c08a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -251,7 +251,7 @@ loop_validate_block_size(unsigned short bsize)
*/
static void loop_set_size(struct loop_device *lo, loff_t size)
{
- if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, true))
+ if (!set_capacity_and_notify(lo->lo_disk, size))
kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
}
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index a314b9382442..3e812b4c32e6 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -470,7 +470,7 @@ static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
cap_str_10,
cap_str_2);
- set_capacity_revalidate_and_notify(vblk->disk, capacity, true);
+ set_capacity_and_notify(vblk->disk, capacity);
}
static void virtblk_config_changed_work(struct work_struct *work)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 48629d3433b4..79521e33d30e 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2370,7 +2370,7 @@ static void blkfront_connect(struct blkfront_info *info)
return;
printk(KERN_INFO "Setting capacity to %Lu\n",
sectors);
- set_capacity_revalidate_and_notify(info->gd, sectors, true);
+ set_capacity_and_notify(info->gd, sectors);
return;
case BLKIF_STATE_SUSPENDED:
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f6c6479da0e9..6c144e748f8c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2053,7 +2053,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
capacity = 0;
}
- set_capacity_revalidate_and_notify(disk, capacity, true);
+ set_capacity_and_notify(disk, capacity);
nvme_config_discard(disk, ns);
nvme_config_write_zeroes(disk, ns);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e9b898a1a480..679c2c025047 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3261,8 +3261,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
sdkp->first_scan = 0;
- set_capacity_revalidate_and_notify(disk,
- logical_to_sectors(sdp, sdkp->capacity), true);
+ set_capacity_and_notify(disk, logical_to_sectors(sdp, sdkp->capacity));
sd_config_write_same(sdkp);
kfree(buffer);
@@ -3272,7 +3271,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
* capacity to 0.
*/
if (sd_zbc_revalidate_zones(sdkp))
- set_capacity_revalidate_and_notify(disk, 0, true);
+ set_capacity_and_notify(disk, 0);
out:
return 0;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3cbc2781ef34..46553d6d6025 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -314,8 +314,7 @@ static inline int get_disk_ro(struct gendisk *disk)
extern void disk_block_events(struct gendisk *disk);
extern void disk_unblock_events(struct gendisk *disk);
extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
-bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
- bool update_bdev);
+bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
/* drivers/char/random.c */
extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;