History

block: deprecate autoloading based on dev_t

Make the legacy dev_t based autoloading optional and add a deprecation warning. This kind of autoloading has ceased to be useful about 20 years ago.

Christoph Hellwig committed 4 years ago

Commit fbdee711 parent 26291c53 files · +24 −3Browse files

Showing the changes to block/bdev.c (1 of 3 files). Show all

Unified · Split

block/bdev.c+6−3
@@ -733,12 +733,15 @@ struct block_device *blkdev_get_no_open(dev_t dev) · 732 unmodified lines
733733 struct inode *inode;
734734
735735 inode = ilookup(blockdev_superblock, dev);
736− if (!inode) {
736+ if (!inode && IS_ENABLED(CONFIG_BLOCK_LEGACY_AUTOLOAD)) {
737737 blk_request_module(dev);
738738 inode = ilookup(blockdev_superblock, dev);
739− if (!inode)
740− return NULL;
739+ if (inode)
740+ pr_warn_ratelimited(
741+"block device autoloading is deprecated. It will be removed in Linux 5.19\n");
741742 }
743+ if (!inode)
744+ return NULL;
742745
743746 /* switch from the inode reference to a device mode one: */
744747 bdev = &BDEV_I(inode)->bdev;