diff mbox series

[RFC,2/4] bdev: abstract inode lookup on blkdev_get_no_open()

Message ID 20230608032404.1887046-3-mcgrof@kernel.org (mailing list archive)
State Deferred, archived
Headers show
Series bdev: allow buffer-head & iomap aops to co-exist | expand

Commit Message

Luis Chamberlain June 8, 2023, 3:24 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/block/bdev.c b/block/bdev.c
index 91477c3849d2..61d8d2722cda 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -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");