diff mbox series

[19/19] fs: remove ->kill_sb

Message ID 20230913111013.77623-20-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/19] fs: reflow deactivate_locked_super | expand

Commit Message

Christoph Hellwig Sept. 13, 2023, 11:10 a.m. UTC
Now that no instances are left, remove ->kill_sb and mark
generic_shutdown_super static.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Documentation/filesystems/locking.rst |  5 -----
 Documentation/filesystems/vfs.rst     |  5 -----
 fs/super.c                            | 25 +++++++++----------------
 include/linux/fs.h                    |  2 --
 4 files changed, 9 insertions(+), 28 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index c33e2f03ed1f69..e4ca99c0828d00 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -221,7 +221,6 @@  prototypes::
 	struct dentry *(*mount) (struct file_system_type *, int,
 		       const char *, void *);
 	void (*shutdown_sb) (struct super_block *);
-	void (*kill_sb) (struct super_block *);
 	void (*free_sb) (struct super_block *);
 
 locking rules:
@@ -231,16 +230,12 @@  ops		may block
 =======		=========
 mount		yes
 shutdown_sb	yes
-kill_sb		yes
 free_sb		yes
 =======		=========
 
 ->mount() returns ERR_PTR or the root dentry; its superblock should be locked
 on return.
 
-->kill_sb() takes a write-locked superblock, does all shutdown work on it,
-unlocks and drops the reference.
-
 address_space_operations
 ========================
 prototypes::
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index 1a7c6926c31f34..29513ee1d34ede 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -120,7 +120,6 @@  members are defined:
 		struct dentry *(*mount) (struct file_system_type *, int,
 			const char *, void *);
 		void (*shutdown_sb) (struct super_block *);
-		void (*kill_sb) (struct super_block *);
 		void (*free_sb) (struct super_block *);
 		struct module *owner;
 		struct file_system_type * next;
@@ -164,10 +163,6 @@  members are defined:
 	Note: dentries and inodes are normally taken care of and do not need
 	specific handling unless they are pinned by kernel users.
 
-``kill_sb``
-	the method to call when an instance of this filesystem should be
-	shut down
-
 ``free_sb``
 	Free file system specific resources like sb->s_fs_info that are
 	still needed while inodes are freed during umount.
diff --git a/fs/super.c b/fs/super.c
index 805ca1dd1e23f2..d9c564e70ffcd5 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -458,6 +458,8 @@  static void kill_super_notify(struct super_block *sb)
 	super_wake(sb, SB_DEAD);
 }
 
+static void generic_shutdown_super(struct super_block *sb);
+
 /**
  *	deactivate_locked_super	-	drop an active reference to superblock
  *	@s: superblock to deactivate
@@ -480,15 +482,11 @@  void deactivate_locked_super(struct super_block *s)
 
 	unregister_shrinker(&s->s_shrink);
 
-	if (fs->kill_sb) {
-		fs->kill_sb(s);
-	} else {
-		if (fs->shutdown_sb)
-			fs->shutdown_sb(s);
-		generic_shutdown_super(s);
-		if (fs->free_sb)
-			fs->free_sb(s);
-	}
+	if (fs->shutdown_sb)
+		fs->shutdown_sb(s);
+	generic_shutdown_super(s);
+	if (fs->free_sb)
+		fs->free_sb(s);
 
 	kill_super_notify(s);
 
@@ -661,16 +659,13 @@  EXPORT_SYMBOL(retire_super);
  *	@sb: superblock to kill
  *
  *	generic_shutdown_super() does all fs-independent work on superblock
- *	shutdown.  Typical ->kill_sb() should pick all fs-specific objects
- *	that need destruction out of superblock, call generic_shutdown_super()
- *	and release aforementioned objects.  Note: dentries and inodes _are_
- *	taken care of and do not need specific handling.
+ *	shutdown. 
  *
  *	Upon calling this function, the filesystem may no longer alter or
  *	rearrange the set of dentries belonging to this super_block, nor may it
  *	change the attachments of dentries to inodes.
  */
-void generic_shutdown_super(struct super_block *sb)
+static void generic_shutdown_super(struct super_block *sb)
 {
 	const struct super_operations *sop = sb->s_op;
 
@@ -743,8 +738,6 @@  void generic_shutdown_super(struct super_block *sb)
 	}
 }
 
-EXPORT_SYMBOL(generic_shutdown_super);
-
 bool mount_capable(struct fs_context *fc)
 {
 	if (!(fc->fs_type->fs_flags & FS_USERNS_MOUNT))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 302be5dfc1a04a..f57d3a27b488f7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2340,7 +2340,6 @@  struct file_system_type {
 	const struct fs_parameter_spec *parameters;
 	struct dentry *(*mount) (struct file_system_type *, int,
 		       const char *, void *);
-	void (*kill_sb) (struct super_block *);
 	void (*shutdown_sb)(struct super_block *sb);
 	void (*free_sb)(struct super_block *sb);
 	struct module *owner;
@@ -2382,7 +2381,6 @@  extern struct dentry *mount_nodev(struct file_system_type *fs_type,
 	int (*fill_super)(struct super_block *, void *, int));
 extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path);
 void retire_super(struct super_block *sb);
-void generic_shutdown_super(struct super_block *sb);
 void block_free_sb(struct super_block *sb);
 void litter_shutdown_sb(struct super_block *sb);
 void deactivate_super(struct super_block *sb);