linux-fsdevel.vger.kernel.org archive mirror
 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 1/4] bdev: replace export of blockdev_superblock with BDEVFS_MAGIC
Date: Wed,  7 Jun 2023 20:24:01 -0700	[thread overview]
Message-ID: <20230608032404.1887046-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20230608032404.1887046-1-mcgrof@kernel.org>

There is no need to export blockdev_superblock because we can just
use the magic value of the block device cache super block, which is
already in place, BDEVFS_MAGIC. So just check for that.

This let's us remove the export of blockdev_superblock and also
let's this block dev cache scale as it wishes internally. For
instance in the future we may have different super block for each
block device. Right now it is all shared on one super block.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 block/bdev.c       | 1 -
 include/linux/fs.h | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index 21c63bfef323..91477c3849d2 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -379,7 +379,6 @@ static struct file_system_type bd_type = {
 };
 
 struct super_block *blockdev_superblock __read_mostly;
-EXPORT_SYMBOL_GPL(blockdev_superblock);
 
 void __init bdev_cache_init(void)
 {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0b54ac1d331b..948a384af8a3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -43,6 +43,7 @@
 #include <linux/cred.h>
 #include <linux/mnt_idmapping.h>
 #include <linux/slab.h>
+#include <uapi/linux/magic.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -2388,10 +2389,9 @@ extern struct kmem_cache *names_cachep;
 #define __getname()		kmem_cache_alloc(names_cachep, GFP_KERNEL)
 #define __putname(name)		kmem_cache_free(names_cachep, (void *)(name))
 
-extern struct super_block *blockdev_superblock;
 static inline bool sb_is_blkdev_sb(struct super_block *sb)
 {
-	return IS_ENABLED(CONFIG_BLOCK) && sb == blockdev_superblock;
+	return IS_ENABLED(CONFIG_BLOCK) && sb->s_magic == BDEVFS_MAGIC;
 }
 
 void emergency_thaw_all(void);
-- 
2.39.2


  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 ` Luis Chamberlain [this message]
2023-06-08 10:22   ` [RFC 1/4] bdev: replace export of blockdev_superblock with BDEVFS_MAGIC Jan Kara
2023-06-08 13:53   ` Christoph Hellwig
2023-06-08  3:24 ` [RFC 2/4] bdev: abstract inode lookup on blkdev_get_no_open() Luis Chamberlain
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-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).