@@ -666,15 +666,20 @@ static void blkdev_put_part(struct block_device *part, fmode_t mode)
blkdev_put_whole(whole, mode);
}
+static struct inode *blkdev_inode_lookup(dev_t dev)
+{
+ return ilookup(blockdev_superblock, dev);
+}
+
struct block_device *blkdev_get_no_open(dev_t dev)
{
struct block_device *bdev;
struct inode *inode;
- inode = ilookup(blockdev_superblock, dev);
+ inode = blkdev_inode_lookup(dev);
if (!inode && IS_ENABLED(CONFIG_BLOCK_LEGACY_AUTOLOAD)) {
blk_request_module(dev);
- inode = ilookup(blockdev_superblock, dev);
+ inode = blkdev_inode_lookup(dev);
if (inode)
pr_warn_ratelimited(
"block device autoloading is deprecated and will be removed.\n");
Provide an abstraction for how we lookup an inode on blkdev_get_no_open() so we can later expand upon the implementation on just relying on one super block. This will make subsequent changes easier to review. This introduces no functional changes. Although we all probably want to just remove BLOCK_LEGACY_AUTOLOAD removing it before has proven issues with both loopback [0] and is expected to break mdraid [1], so this takes the more careful approach to just keeping it. [0] https://lore.kernel.org/all/20220222085354.GA6423@lst.de/T/#u [1] https://lore.kernel.org/all/20220503212848.5853-1-dmoulding@me.com/ Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- block/bdev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)