Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-02-24 20:07:46 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-02-24 20:07:46 -0800
commit859041ac5a91c867c6af329a0a417bc1e1ec5c69 (patch)
tree164f5a0a2c081f1c58fdea073f1796ca9c2dfe96
parentad9e3359dfcadb92560c16c76771c8243219e11b (diff)
[PATCH] (2/3) fs/super.c cleanups
Now remove_super() is called only from kill_super(). We move the code that closes device/drops reference to filesystem type from remove_super() into its caller.
-rw-r--r--fs/super.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/super.c b/fs/super.c
index 5295c6a5d336..fad35d0daf26 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -382,31 +382,22 @@ static void put_anon_dev(kdev_t dev);
* remove_super - makes superblock unreachable
* @s: superblock in question
*
- * Removes superblock from the lists, unlocks it, drop the reference
- * and releases the hosting device. @s should have no active
- * references by that time and after remove_super() it's essentially
- * in rundown mode - all remaining references are temporary, no new
- * reference of any sort are going to appear and all holders of
- * temporary ones will eventually drop them. At that point superblock
- * itself will be destroyed; all its contents is already gone.
+ * Removes superblock from the lists, unlocks it and drop the reference
+ * @s should have no active references by that time and after
+ * remove_super() it's essentially in rundown mode - all remaining
+ * references are temporary, no new reference of any sort are going
+ * to appear and all holders of temporary ones will eventually drop them.
+ * At that point superblock itself will be destroyed; all its contents
+ * is already gone.
*/
static void remove_super(struct super_block *s)
{
- kdev_t dev = s->s_dev;
- struct block_device *bdev = s->s_bdev;
- struct file_system_type *fs = s->s_type;
-
spin_lock(&sb_lock);
list_del(&s->s_list);
list_del(&s->s_instances);
spin_unlock(&sb_lock);
up_write(&s->s_umount);
put_super(s);
- put_filesystem(fs);
- if (bdev)
- blkdev_put(bdev, BDEV_FS);
- else
- put_anon_dev(dev);
}
struct vfsmount *alloc_vfsmnt(char *name);
@@ -822,6 +813,8 @@ 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;
@@ -857,6 +850,11 @@ void kill_super(struct super_block *sb)
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)