All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: hch@infradead.org, djwong@kernel.org, dchinner@redhat.com,
	kbusch@kernel.org, willy@infradead.org
Cc: hare@suse.de, ritesh.list@gmail.com, rgoldwyn@suse.com,
	jack@suse.cz, patches@lists.linux.dev, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	p.raghav@samsung.com, da.gomez@samsung.com,
	rohan.puri@samsung.com, rpuri.linux@gmail.com, mcgrof@kernel.org,
	corbet@lwn.net, jake@lwn.net
Subject: [RFC 2/4] bdev: abstract inode lookup on blkdev_get_no_open()
Date: Wed,  7 Jun 2023 20:24:02 -0700	[thread overview]
Message-ID: <20230608032404.1887046-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20230608032404.1887046-1-mcgrof@kernel.org>

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 --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");
-- 
2.39.2


  parent reply	other threads:[~2023-06-08  3:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  3:24 [RFC 0/4] bdev: allow buffer-head & iomap aops to co-exist Luis Chamberlain
2023-06-08  3:24 ` [RFC 1/4] bdev: replace export of blockdev_superblock with BDEVFS_MAGIC Luis Chamberlain
2023-06-08 10:22   ` Jan Kara
2023-06-08 13:53   ` Christoph Hellwig
2023-06-08  3:24 ` Luis Chamberlain [this message]
2023-06-08  3:24 ` [RFC 3/4] bdev: rename iomap aops Luis Chamberlain
2023-06-08  3:24 ` [RFC 4/4] bdev: extend bdev inode with it's own super_block Luis Chamberlain
2023-06-08 13:37   ` Matthew Wilcox
2023-06-08 13:50     ` Christoph Hellwig
2023-06-08 17:45       ` Luis Chamberlain
2023-06-09  4:20         ` Christoph Hellwig
2023-06-09  9:17           ` Luis Chamberlain
2023-06-08 13:50   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230608032404.1887046-3-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=corbet@lwn.net \
    --cc=da.gomez@samsung.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jake@lwn.net \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=patches@lists.linux.dev \
    --cc=rgoldwyn@suse.com \
    --cc=ritesh.list@gmail.com \
    --cc=rohan.puri@samsung.com \
    --cc=rpuri.linux@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.