mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
block: consolidate __invalidate_device and fsync_bdev
We currently have two interfaces that take a block_devices and the find a mounted file systems to flush or invaldidate data on it. Both are a bit problematic because they only work for the "main" block devices that is used as s_dev for the super_block, and because they don't call into the file system at all. Merge the two into a new bdev_mark_dead helper that does both the syncing and invalidation and which is properly documented. This is in preparation of merging the functionality into the ->mark_dead holder operation so that it will work on additional block devices used by a file systems and give us a single entry point for invalidation of dead devices or media. Note that a single standalone fsync_bdev call for an obscure ioctl remains for now, but that one will also be deal with in a bit. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Message-Id: <20230811100828.1897174-14-hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
127a5093c7
commit
560e20e4bf
@@ -281,7 +281,7 @@ bool disk_check_media_change(struct gendisk *disk)
|
||||
if (!(events & DISK_EVENT_MEDIA_CHANGE))
|
||||
return false;
|
||||
|
||||
__invalidate_device(disk->part0, true);
|
||||
bdev_mark_dead(disk->part0, true);
|
||||
set_bit(GD_NEED_PART_SCAN, &disk->state);
|
||||
return true;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void disk_force_media_change(struct gendisk *disk)
|
||||
{
|
||||
disk_event_uevent(disk, DISK_EVENT_MEDIA_CHANGE);
|
||||
inc_diskseq(disk);
|
||||
__invalidate_device(disk->part0, true);
|
||||
bdev_mark_dead(disk->part0, true);
|
||||
set_bit(GD_NEED_PART_SCAN, &disk->state);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(disk_force_media_change);
|
||||
|
||||
Reference in New Issue
Block a user