aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/super.c b/fs/super.c
index 057b5325b7ef..6987824d0dce 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -20,7 +20,6 @@
20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
21 */ 21 */
22 22
23#include <linux/config.h>
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
26#include <linux/init.h> 25#include <linux/init.h>
@@ -50,11 +49,12 @@ DEFINE_SPINLOCK(sb_lock);
50 49
51/** 50/**
52 * alloc_super - create new superblock 51 * alloc_super - create new superblock
52 * @type: filesystem type superblock should belong to
53 * 53 *
54 * Allocates and initializes a new &struct super_block. alloc_super() 54 * Allocates and initializes a new &struct super_block. alloc_super()
55 * returns a pointer new superblock or %NULL if allocation had failed. 55 * returns a pointer new superblock or %NULL if allocation had failed.
56 */ 56 */
57static struct super_block *alloc_super(void) 57static struct super_block *alloc_super(struct file_system_type *type)
58{ 58{
59 struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); 59 struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER);
60 static struct super_operations default_op; 60 static struct super_operations default_op;
@@ -73,6 +73,13 @@ static struct super_block *alloc_super(void)
73 INIT_LIST_HEAD(&s->s_inodes); 73 INIT_LIST_HEAD(&s->s_inodes);
74 init_rwsem(&s->s_umount); 74 init_rwsem(&s->s_umount);
75 mutex_init(&s->s_lock); 75 mutex_init(&s->s_lock);
76 lockdep_set_class(&s->s_umount, &type->s_umount_key);
77 /*
78 * The locking rules for s_lock are up to the
79 * filesystem. For example ext3fs has different
80 * lock ordering than usbfs:
81 */
82 lockdep_set_class(&s->s_lock, &type->s_lock_key);
76 down_write(&s->s_umount); 83 down_write(&s->s_umount);
77 s->s_count = S_BIAS; 84 s->s_count = S_BIAS;
78 atomic_set(&s->s_active, 1); 85 atomic_set(&s->s_active, 1);
@@ -192,7 +199,7 @@ EXPORT_SYMBOL(deactivate_super);
192 * success, 0 if we had failed (superblock contents was already dead or 199 * success, 0 if we had failed (superblock contents was already dead or
193 * dying when grab_super() had been called). 200 * dying when grab_super() had been called).
194 */ 201 */
195static int grab_super(struct super_block *s) 202static int grab_super(struct super_block *s) __releases(sb_lock)
196{ 203{
197 s->s_count++; 204 s->s_count++;
198 spin_unlock(&sb_lock); 205 spin_unlock(&sb_lock);
@@ -296,7 +303,7 @@ retry:
296 } 303 }
297 if (!s) { 304 if (!s) {
298 spin_unlock(&sb_lock); 305 spin_unlock(&sb_lock);
299 s = alloc_super(); 306 s = alloc_super(type);
300 if (!s) 307 if (!s)
301 return ERR_PTR(-ENOMEM); 308 return ERR_PTR(-ENOMEM);
302 goto retry; 309 goto retry;
@@ -871,8 +878,6 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
871 return mnt; 878 return mnt;
872} 879}
873 880
874EXPORT_SYMBOL_GPL(do_kern_mount);
875
876struct vfsmount *kern_mount(struct file_system_type *type) 881struct vfsmount *kern_mount(struct file_system_type *type)
877{ 882{
878 return vfs_kern_mount(type, 0, type->name, NULL); 883 return vfs_kern_mount(type, 0, type->name, NULL);