Convert jffs2 from ->kill_sb to ->shutdown_sb and ->free_sb. Drop the otherwise unused kill_mtd_super helpers, as there is no benefit in it over just calling put_mtd_device on sb->s_mtd. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- drivers/mtd/mtdsuper.c | 12 ------------ fs/jffs2/super.c | 22 ++++++++++++++-------- include/linux/mtd/super.h | 2 -- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index b7e3763c47f0cd..66da2e6f90f5f5 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c @@ -165,15 +165,3 @@ int get_tree_mtd(struct fs_context *fc, return -EINVAL; } EXPORT_SYMBOL_GPL(get_tree_mtd); - -/* - * destroy an MTD-based superblock - */ -void kill_mtd_super(struct super_block *sb) -{ - generic_shutdown_super(sb); - put_mtd_device(sb->s_mtd); - sb->s_mtd = NULL; -} - -EXPORT_SYMBOL_GPL(kill_mtd_super); diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 7ea37f49f1e18e..14577368202e90 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -340,21 +340,27 @@ static void jffs2_put_super (struct super_block *sb) jffs2_dbg(1, "%s(): returning\n", __func__); } -static void jffs2_kill_sb(struct super_block *sb) +static void jffs2_shutdown_sb(struct super_block *sb) { struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); + if (c && !sb_rdonly(sb)) jffs2_stop_garbage_collect_thread(c); - kill_mtd_super(sb); - kfree(c); +} + +static void jffs2_free_sb(struct super_block *sb) +{ + put_mtd_device(sb->s_mtd); + kfree(JFFS2_SB_INFO(sb)); } static struct file_system_type jffs2_fs_type = { - .owner = THIS_MODULE, - .name = "jffs2", - .init_fs_context = jffs2_init_fs_context, - .parameters = jffs2_fs_parameters, - .kill_sb = jffs2_kill_sb, + .owner = THIS_MODULE, + .name = "jffs2", + .init_fs_context = jffs2_init_fs_context, + .parameters = jffs2_fs_parameters, + .shutdown_sb = jffs2_shutdown_sb, + .free_sb = jffs2_free_sb, }; MODULE_ALIAS_FS("jffs2"); diff --git a/include/linux/mtd/super.h b/include/linux/mtd/super.h index 3608a6c36faceb..f6d5c1a17eec23 100644 --- a/include/linux/mtd/super.h +++ b/include/linux/mtd/super.h @@ -17,8 +17,6 @@ extern int get_tree_mtd(struct fs_context *fc, int (*fill_super)(struct super_block *sb, struct fs_context *fc)); -extern void kill_mtd_super(struct super_block *sb); - #endif /* __KERNEL__ */ -- 2.39.2