Commit 449f4ec9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b200e38c
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -47,16 +47,14 @@ 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);

	if (capacity != size && capacity != 0 && size != 0) {
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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);
}

+1 −1
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading