linux/super: flatten mount/remount into get_tree/reconfigure

With the old API gone, there's no need to massage new-style calls into
its shape and call another function; we can just make those handlers
work directly.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@truenas.com>
Closes #18339
This commit is contained in:
Rob Norris 2026-03-15 13:17:39 +11:00 committed by Brian Behlendorf
parent f828aeb62a
commit 5ebb9ff914

View File

@ -266,21 +266,6 @@ zpl_statfs(struct dentry *dentry, struct kstatfs *statp)
return (error); return (error);
} }
static int
zpl_remount_fs(struct super_block *sb, int *flags, char *data)
{
zfs_mnt_t zm = { .mnt_osname = NULL, .mnt_data = data };
fstrans_cookie_t cookie;
int error;
cookie = spl_fstrans_mark();
error = -zfs_remount(sb, flags, &zm);
spl_fstrans_unmark(cookie);
ASSERT3S(error, <=, 0);
return (error);
}
static int static int
__zpl_show_devname(struct seq_file *seq, zfsvfs_t *zfsvfs) __zpl_show_devname(struct seq_file *seq, zfsvfs_t *zfsvfs)
{ {
@ -458,19 +443,6 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm)
return (s); return (s);
} }
static struct dentry *
zpl_mount(struct file_system_type *fs_type, int flags,
const char *osname, void *data)
{
zfs_mnt_t zm = { .mnt_osname = osname, .mnt_data = data };
struct super_block *sb = zpl_mount_impl(fs_type, flags, &zm);
if (IS_ERR(sb))
return (ERR_CAST(sb));
return (dget(sb->s_root));
}
static void static void
zpl_kill_sb(struct super_block *sb) zpl_kill_sb(struct super_block *sb)
{ {
@ -506,15 +478,6 @@ zpl_prune_sb(uint64_t nr_to_scan, void *arg)
#endif #endif
} }
/*
* Since kernel 5.2, the "new" fs_context-based mount API has been preferred
* over the traditional file_system_type->mount() and
* super_operations->remount_fs() callbacks, which were deprectate. In 7.0,
* those callbacks were removed.
*
* Currently, the old-style interface are the only ones we need, so this is
* a simple compatibility shim to adapt the new API to the old-style calls.
*/
static int static int
zpl_parse_monolithic(struct fs_context *fc, void *data) zpl_parse_monolithic(struct fs_context *fc, void *data)
{ {
@ -529,8 +492,13 @@ zpl_parse_monolithic(struct fs_context *fc, void *data)
static int static int
zpl_get_tree(struct fs_context *fc) zpl_get_tree(struct fs_context *fc)
{ {
struct dentry *root = zfs_mnt_t zm = { .mnt_osname = fc->source, .mnt_data = fc->fs_private };
zpl_mount(fc->fs_type, fc->sb_flags, fc->source, fc->fs_private);
struct super_block *sb = zpl_mount_impl(fc->fs_type, fc->sb_flags, &zm);
if (IS_ERR(sb))
return (PTR_ERR(sb));
struct dentry *root = dget(sb->s_root);
if (IS_ERR(root)) if (IS_ERR(root))
return (PTR_ERR(root)); return (PTR_ERR(root));
@ -541,7 +509,16 @@ zpl_get_tree(struct fs_context *fc)
static int static int
zpl_reconfigure(struct fs_context *fc) zpl_reconfigure(struct fs_context *fc)
{ {
return (zpl_remount_fs(fc->root->d_sb, &fc->sb_flags, fc->fs_private)); zfs_mnt_t zm = { .mnt_osname = NULL, .mnt_data = fc->fs_private };
fstrans_cookie_t cookie;
int error;
cookie = spl_fstrans_mark();
error = -zfs_remount(fc->root->d_sb, &fc->sb_flags, &zm);
spl_fstrans_unmark(cookie);
ASSERT3S(error, <=, 0);
return (error);
} }
const struct fs_context_operations zpl_fs_context_operations = { const struct fs_context_operations zpl_fs_context_operations = {