Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-02-24 20:07:53 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-02-24 20:07:53 -0800
commita99dcd865e3ac3b326ba15b5873fcb043197fc6a (patch)
tree01b1be159b1ee07d266d41d7ef2a17cf825f4223
parent859041ac5a91c867c6af329a0a417bc1e1ec5c69 (diff)
[PATCH] (3/3) fs/super.c cleanups
Preparation to adding new method: new helper - shutdown_super(). It is cut from kill_super() and it had absorbed all actions done with superblock contents - now kill_super(s) is simply struct file_system_type *fs = s->s_type; if (!deactivate_super(s)) return; shutdown_super(s); put_filesystem(fs); and shutdown_super() is going to become a method.
-rw-r--r--fs/super.c111
1 files changed, 62 insertions, 49 deletions
diff --git a/fs/super.c b/fs/super.c
index fad35d0daf26..b722653292d4 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -400,6 +400,68 @@ static void remove_super(struct super_block *s)
put_super(s);
}
+static void generic_shutdown_super(struct super_block *sb)
+{
+ struct dentry *root = sb->s_root;
+ struct super_operations *sop = sb->s_op;
+
+ if (root) {
+ sb->s_root = NULL;
+ shrink_dcache_parent(root);
+ dput(root);
+ fsync_super(sb);
+ lock_super(sb);
+ lock_kernel();
+ sb->s_flags &= ~MS_ACTIVE;
+ /* bad name - it should be evict_inodes() */
+ invalidate_inodes(sb);
+ if (sop) {
+ if (sop->write_super && sb->s_dirt)
+ sop->write_super(sb);
+ if (sop->put_super)
+ sop->put_super(sb);
+ }
+
+ /* Forget any remaining inodes */
+ if (invalidate_inodes(sb)) {
+ printk("VFS: Busy inodes after unmount. "
+ "Self-destruct in 5 seconds. Have a nice day...\n");
+ }
+
+ unlock_kernel();
+ unlock_super(sb);
+ }
+ remove_super(sb);
+}
+
+static void shutdown_super(struct super_block *sb)
+{
+ struct file_system_type *fs = sb->s_type;
+ kdev_t dev = sb->s_dev;
+ struct block_device *bdev = sb->s_bdev;
+
+ /* Need to clean after the sucker */
+ if (fs->fs_flags & FS_LITTER && sb->s_root)
+ d_genocide(sb->s_root);
+ generic_shutdown_super(sb);
+ if (bdev)
+ blkdev_put(bdev, BDEV_FS);
+ else
+ put_anon_dev(dev);
+}
+
+void kill_super(struct super_block *sb)
+{
+ struct file_system_type *fs = sb->s_type;
+
+ if (!deactivate_super(sb))
+ return;
+
+ down_write(&sb->s_umount);
+ shutdown_super(sb);
+ put_filesystem(fs);
+}
+
struct vfsmount *alloc_vfsmnt(char *name);
void free_vfsmnt(struct vfsmount *mnt);
@@ -808,55 +870,6 @@ out:
return (struct vfsmount *)sb;
}
-void kill_super(struct super_block *sb)
-{
- struct dentry *root = sb->s_root;
- struct file_system_type *fs = sb->s_type;
- struct super_operations *sop = sb->s_op;
- kdev_t dev = sb->s_dev;
- struct block_device *bdev = sb->s_bdev;
-
- if (!deactivate_super(sb))
- return;
-
- down_write(&sb->s_umount);
- if (sb->s_root) {
- sb->s_root = NULL;
- /* Need to clean after the sucker */
- if (fs->fs_flags & FS_LITTER)
- d_genocide(root);
- shrink_dcache_parent(root);
- dput(root);
- fsync_super(sb);
- lock_super(sb);
- lock_kernel();
- sb->s_flags &= ~MS_ACTIVE;
- /* bad name - it should be evict_inodes() */
- invalidate_inodes(sb);
- if (sop) {
- if (sop->write_super && sb->s_dirt)
- sop->write_super(sb);
- if (sop->put_super)
- sop->put_super(sb);
- }
-
- /* Forget any remaining inodes */
- if (invalidate_inodes(sb)) {
- printk("VFS: Busy inodes after unmount. "
- "Self-destruct in 5 seconds. Have a nice day...\n");
- }
-
- unlock_kernel();
- unlock_super(sb);
- }
- remove_super(sb);
- if (bdev)
- blkdev_put(bdev, BDEV_FS);
- else
- put_anon_dev(dev);
- put_filesystem(fs);
-}
-
struct vfsmount *kern_mount(struct file_system_type *type)
{
return do_kern_mount(type->name, 0, (char *)type->name, NULL);