Skip to contentSkip to conversation

fs/affs: free affs_sb_info in put_super()

PATCH New Fabian Frederick 1 participant 1 message Mar 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/affs: free affs_sb_info in put_super()

kill_block_super() calls generic_shutdown_super() calling FS put_user() where we generally free superblock specific information.

This removes unneeded affs_kill_sb()

sbi is automatically reserved in fill_super() so there is no need to test it.

---
 fs/affs/super.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
fs/affs/super.c +7 -15
index c2c27a8..f273203 100644
@@ -46,9 +46,14 @@ static void
 affs_put_super(struct super_block *sb)
 {
 	struct affs_sb_info *sbi = AFFS_SB(sb);
-	pr_debug("%s()\n", __func__);
 
+	pr_debug("%s()\n", __func__);
 	cancel_delayed_work_sync(&sbi->sb_work);
+	affs_free_bitmap(sb);
+	affs_brelse(sbi->s_root_bh);
+	kfree(sbi->s_prefix);
+	mutex_destroy(&sbi->s_bmlock);
+	kfree(sbi);
 }
 
 static int
@@ -604,24 +609,11 @@ static struct dentry *affs_mount(struct file_system_type *fs_type,
 	return mount_bdev(fs_type, flags, dev_name, data, affs_fill_super);
 }
 
-static void affs_kill_sb(struct super_block *sb)
-{
-	struct affs_sb_info *sbi = AFFS_SB(sb);
-	kill_block_super(sb);
-	if (sbi) {
-		affs_free_bitmap(sb);
-		affs_brelse(sbi->s_root_bh);
-		kfree(sbi->s_prefix);
-		mutex_destroy(&sbi->s_bmlock);
-		kfree(sbi);
-	}
-}
-
 static struct file_system_type affs_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "affs",
 	.mount		= affs_mount,
-	.kill_sb	= affs_kill_sb,
+	.kill_sb	= kill_block_super,
 	.fs_flags	= FS_REQUIRES_DEV,
 };
 MODULE_ALIAS_FS("affs");
Signature · 1 line
2.9.3