mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
block: simplify the disk_force_media_change interface
Hard code the events to DISK_EVENT_MEDIA_CHANGE as that is the only useful use case, and drop the superfluous return value. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Message-Id: <20230811100828.1897174-9-hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
0c1c9a27ce
commit
ab6860f62b
@ -294,25 +294,18 @@ EXPORT_SYMBOL(disk_check_media_change);
|
|||||||
* @disk: the disk which will raise the event
|
* @disk: the disk which will raise the event
|
||||||
* @events: the events to raise
|
* @events: the events to raise
|
||||||
*
|
*
|
||||||
* Generate uevents for the disk. If DISK_EVENT_MEDIA_CHANGE is present,
|
* Should be called when the media changes for @disk. Generates a uevent
|
||||||
* attempt to free all dentries and inodes and invalidates all block
|
* and attempts to free all dentries and inodes and invalidates all block
|
||||||
* device page cache entries in that case.
|
* device page cache entries in that case.
|
||||||
*
|
|
||||||
* Returns %true if DISK_EVENT_MEDIA_CHANGE was raised, or %false if not.
|
|
||||||
*/
|
*/
|
||||||
bool disk_force_media_change(struct gendisk *disk, unsigned int events)
|
void disk_force_media_change(struct gendisk *disk)
|
||||||
{
|
{
|
||||||
disk_event_uevent(disk, events);
|
disk_event_uevent(disk, DISK_EVENT_MEDIA_CHANGE);
|
||||||
|
|
||||||
if (!(events & DISK_EVENT_MEDIA_CHANGE))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
inc_diskseq(disk);
|
inc_diskseq(disk);
|
||||||
if (__invalidate_device(disk->part0, true))
|
if (__invalidate_device(disk->part0, true))
|
||||||
pr_warn("VFS: busy inodes on changed media %s\n",
|
pr_warn("VFS: busy inodes on changed media %s\n",
|
||||||
disk->disk_name);
|
disk->disk_name);
|
||||||
set_bit(GD_NEED_PART_SCAN, &disk->state);
|
set_bit(GD_NEED_PART_SCAN, &disk->state);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(disk_force_media_change);
|
EXPORT_SYMBOL_GPL(disk_force_media_change);
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
|
|||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
/* and ... switch */
|
/* and ... switch */
|
||||||
disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
|
disk_force_media_change(lo->lo_disk);
|
||||||
blk_mq_freeze_queue(lo->lo_queue);
|
blk_mq_freeze_queue(lo->lo_queue);
|
||||||
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
|
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
|
||||||
lo->lo_backing_file = file;
|
lo->lo_backing_file = file;
|
||||||
@ -1067,7 +1067,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
|
|||||||
/* suppress uevents while reconfiguring the device */
|
/* suppress uevents while reconfiguring the device */
|
||||||
dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);
|
dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);
|
||||||
|
|
||||||
disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
|
disk_force_media_change(lo->lo_disk);
|
||||||
set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
|
set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
|
||||||
|
|
||||||
lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
|
lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
|
||||||
@ -1171,7 +1171,7 @@ static void __loop_clr_fd(struct loop_device *lo, bool release)
|
|||||||
if (!release)
|
if (!release)
|
||||||
blk_mq_unfreeze_queue(lo->lo_queue);
|
blk_mq_unfreeze_queue(lo->lo_queue);
|
||||||
|
|
||||||
disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
|
disk_force_media_change(lo->lo_disk);
|
||||||
|
|
||||||
if (lo->lo_flags & LO_FLAGS_PARTSCAN) {
|
if (lo->lo_flags & LO_FLAGS_PARTSCAN) {
|
||||||
int err;
|
int err;
|
||||||
|
@ -750,7 +750,7 @@ static inline int bdev_read_only(struct block_device *bdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
||||||
bool disk_force_media_change(struct gendisk *disk, unsigned int events);
|
void disk_force_media_change(struct gendisk *disk);
|
||||||
|
|
||||||
void add_disk_randomness(struct gendisk *disk) __latent_entropy;
|
void add_disk_randomness(struct gendisk *disk) __latent_entropy;
|
||||||
void rand_initialize_disk(struct gendisk *disk);
|
void rand_initialize_disk(struct gendisk *disk);
|
||||||
|
Loading…
Reference in New Issue
Block a user