[PATCH 1/2] fs: export sget_dev()

Christian Brauner brauner at kernel.org
Wed Aug 30 01:05:57 PDT 2023


On Wed, Aug 30, 2023 at 08:14:09AM +0200, Christoph Hellwig wrote:
> > +struct super_block *sget_dev(struct fs_context *fc, dev_t dev)
> 
> A kerneldoc comment would probably be useful here.

Added the following in-treep:

diff --git a/fs/super.c b/fs/super.c
index 158e093f23c9..19fa906b118a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1388,6 +1388,26 @@ static int super_s_dev_test(struct super_block *s, struct fs_context *fc)
                s->s_dev == *(dev_t *)fc->sget_key;
 }

+/**
+ * sget_dev - Find or create a superblock by device number
+ * @fc:        Filesystem context.
+ * @dev: device number
+ *
+ * Find or create a superblock using the provided device number that
+ * will be stored in fc->sget_key.
+ *
+ * If an extant superblock is matched, then that will be returned with
+ * an elevated reference count that the caller must transfer or discard.
+ *
+ * If no match is made, a new superblock will be allocated and basic
+ * initialisation will be performed (s_type, s_fs_info and s_id will be
+ * set and the set() callback will be invoked), the superblock will be
+ * published and it will be returned in a partially constructed state
+ * with SB_BORN and SB_ACTIVE as yet unset.
+ *
+ * Return: an existing or newly created superblock on success, an an
+ *         error pointer on failure.
+ */
 struct super_block *sget_dev(struct fs_context *fc, dev_t dev)
 {
        fc->sget_key = &dev;



More information about the linux-mtd mailing list