vfs-7.4-rc1.shared.super

Please consider pulling these changes from the signed vfs-7.4-rc1.shared.super tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCatHrlwAKCRCRxhvAZXjc
 ojDwAP9WqfdL1zdLrCVIEGuIlAuCIBHlqx0WGuafrPYgZd8PmgD/f0qdhXyDaZs4
 e9HXjY41WhrC032FwBMkJ3MzCKcCSwE=
 =GdeH
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.4-rc1.shared.super' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull superblock updates from Christian Brauner:
 "This renames vfs_get_super() to get_tree_super() and exports it so a
  filesystem that needs its own superblock matching policy can reuse it
  instead of open-coding sget_fc() plus fill_super().

  erofs uses it to share a superblock between file-backed mounts"

* tag 'vfs-7.4-rc1.shared.super' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  fs: rename vfs_get_super() to get_tree_super() and export it
This commit is contained in:
Linus Torvalds 2026-10-19 20:55:04 -10:00
commit 58aeff92ee
2 changed files with 19 additions and 4 deletions

View File

@ -1374,7 +1374,17 @@ static int test_single_super(struct super_block *s, struct fs_context *fc)
return 1;
}
static int vfs_get_super(struct fs_context *fc,
/**
* get_tree_super - Get a superblock, optionally sharing an existing one
* @fc: The filesystem context holding the parameters
* @test: Comparison function to find a matching existing superblock, or NULL
* @fill_super: Helper to initialise a new superblock
*
* If @test is non-NULL and matches an existing superblock, that superblock is
* reused; otherwise a new anonymous superblock is created and initialised with
* @fill_super. Passing NULL for @test always creates a new superblock.
*/
int get_tree_super(struct fs_context *fc,
int (*test)(struct super_block *, struct fs_context *),
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
@ -1401,12 +1411,13 @@ static int vfs_get_super(struct fs_context *fc,
deactivate_locked_super(sb);
return err;
}
EXPORT_SYMBOL_GPL(get_tree_super);
int get_tree_nodev(struct fs_context *fc,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
{
return vfs_get_super(fc, NULL, fill_super);
return get_tree_super(fc, NULL, fill_super);
}
EXPORT_SYMBOL(get_tree_nodev);
@ -1414,7 +1425,7 @@ int get_tree_single(struct fs_context *fc,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
{
return vfs_get_super(fc, test_single_super, fill_super);
return get_tree_super(fc, test_single_super, fill_super);
}
EXPORT_SYMBOL(get_tree_single);
@ -1424,7 +1435,7 @@ int get_tree_keyed(struct fs_context *fc,
void *key)
{
fc->s_fs_info = key;
return vfs_get_super(fc, test_keyed_super, fill_super);
return get_tree_super(fc, test_keyed_super, fill_super);
}
EXPORT_SYMBOL(get_tree_keyed);

View File

@ -150,6 +150,10 @@ extern int vfs_parse_fs_param_source(struct fs_context *fc,
struct fs_parameter *param);
extern void fc_drop_locked(struct fs_context *fc);
int get_tree_super(struct fs_context *fc,
int (*test)(struct super_block *, struct fs_context *),
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));