summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-08 16:53:29 +0200
committerJens Axboe <axboe@kernel.dk>2020-09-10 17:32:30 +0200
commit95f6f3a46fc4ee1a2b216a6b46bdf2b450f1877f (patch)
tree4ecb01f17029bcdc4364a96c21e10adda36161b2 /fs/block_dev.c
parentblock: make QUEUE_SYSFS_BIT_FNS more useful (diff)
downloadlinux-95f6f3a46fc4ee1a2b216a6b46bdf2b450f1877f.tar.xz
linux-95f6f3a46fc4ee1a2b216a6b46bdf2b450f1877f.zip
block: add a bdev_check_media_change helper
Like check_disk_changed, except that it does not call ->revalidate_disk but leaves that to the caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index c70c41ecba48..c6ac0bd22eca 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1379,21 +1379,10 @@ EXPORT_SYMBOL(revalidate_disk_size);
*/
int check_disk_change(struct block_device *bdev)
{
- struct gendisk *disk = bdev->bd_disk;
- const struct block_device_operations *bdops = disk->fops;
- unsigned int events;
-
- events = disk_clear_events(disk, DISK_EVENT_MEDIA_CHANGE |
- DISK_EVENT_EJECT_REQUEST);
- if (!(events & DISK_EVENT_MEDIA_CHANGE))
+ if (!bdev_check_media_change(bdev))
return 0;
-
- if (__invalidate_device(bdev, true))
- pr_warn("VFS: busy inodes on changed media %s\n",
- disk->disk_name);
- set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
- if (bdops->revalidate_disk)
- bdops->revalidate_disk(bdev->bd_disk);
+ if (bdev->bd_disk->fops->revalidate_disk)
+ bdev->bd_disk->fops->revalidate_disk(bdev->bd_disk);
return 1;
}