[PATCH v2] vfs: Make vfs_get_super() internal

From: Dawei Li
Date: Sun Oct 30 2022 - 09:06:38 EST


For now there are no external callers of vfs_get_super(),
so just make it an internal API.

v1: https://lore.kernel.org/all/TYCP286MB2323D37F4F6400FD07D7C7F7CA319@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

v2: move vfs_get_super_keying to super.c, as the suggestion
from Christian Brauner.

base-commit: 3aca47127a646165965ff52803e2b269eed91afc

Signed-off-by: Dawei Li <set_pte_at@xxxxxxxxxxx>
---
fs/super.c | 13 +++++++++++--
include/linux/fs_context.h | 14 --------------
2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 6a82660e1adb..24e31e458552 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1111,6 +1111,16 @@ static int test_single_super(struct super_block *s, struct fs_context *fc)
return 1;
}

+/*
+ * sget() wrappers to be called from the ->get_tree() op.
+ */
+enum vfs_get_super_keying {
+ vfs_get_single_super, /* Only one such superblock may exist */
+ vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */
+ vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */
+ vfs_get_independent_super, /* Multiple independent superblocks may exist */
+};
+
/**
* vfs_get_super - Get a superblock with a search key set in s_fs_info.
* @fc: The filesystem context holding the parameters
@@ -1136,7 +1146,7 @@ static int test_single_super(struct super_block *s, struct fs_context *fc)
* A permissions check is made by sget_fc() unless we're getting a superblock
* for a kernel-internal mount or a submount.
*/
-int vfs_get_super(struct fs_context *fc,
+static int vfs_get_super(struct fs_context *fc,
enum vfs_get_super_keying keying,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
@@ -1189,7 +1199,6 @@ int vfs_get_super(struct fs_context *fc,
deactivate_locked_super(sb);
return err;
}
-EXPORT_SYMBOL(vfs_get_super);

int get_tree_nodev(struct fs_context *fc,
int (*fill_super)(struct super_block *sb,
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index 13fa6f3df8e4..87a34f2fa68d 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -145,20 +145,6 @@ extern void fc_drop_locked(struct fs_context *fc);
int reconfigure_single(struct super_block *s,
int flags, void *data);

-/*
- * sget() wrappers to be called from the ->get_tree() op.
- */
-enum vfs_get_super_keying {
- vfs_get_single_super, /* Only one such superblock may exist */
- vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */
- vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */
- vfs_get_independent_super, /* Multiple independent superblocks may exist */
-};
-extern int vfs_get_super(struct fs_context *fc,
- enum vfs_get_super_keying keying,
- int (*fill_super)(struct super_block *sb,
- struct fs_context *fc));
-
extern int get_tree_nodev(struct fs_context *fc,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc));
--
2.25.1