aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:25:27 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:09 -0400
commitcf51624999e56c88154b5f7d451a265db6aabff7 (patch)
treeeee3fd290f9d79b26c4b6a2f1041f596da896a3c /fs/super.c
parent91ebe2a9320db7195d1e25152b5d158fc66dc133 (diff)
[PATCH] lockdep: annotate ->s_lock
Teach special (per-filesystem) locking code to the lock validator. Minimal effect on non-lockdep kernels: one extra parameter to alloc_super(). Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/super.c b/fs/super.c
index 9b780c42d845..5a4fe8be462a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -53,7 +53,7 @@ DEFINE_SPINLOCK(sb_lock);
53 * Allocates and initializes a new &struct super_block. alloc_super() 53 * Allocates and initializes a new &struct super_block. alloc_super()
54 * returns a pointer new superblock or %NULL if allocation had failed. 54 * returns a pointer new superblock or %NULL if allocation had failed.
55 */ 55 */
56static struct super_block *alloc_super(void) 56static struct super_block *alloc_super(struct file_system_type *type)
57{ 57{
58 struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); 58 struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER);
59 static struct super_operations default_op; 59 static struct super_operations default_op;
@@ -72,6 +72,12 @@ static struct super_block *alloc_super(void)
72 INIT_LIST_HEAD(&s->s_inodes); 72 INIT_LIST_HEAD(&s->s_inodes);
73 init_rwsem(&s->s_umount); 73 init_rwsem(&s->s_umount);
74 mutex_init(&s->s_lock); 74 mutex_init(&s->s_lock);
75 /*
76 * The locking rules for s_lock are up to the
77 * filesystem. For example ext3fs has different
78 * lock ordering than usbfs:
79 */
80 lockdep_set_class(&s->s_lock, &type->s_lock_key);
75 down_write(&s->s_umount); 81 down_write(&s->s_umount);
76 s->s_count = S_BIAS; 82 s->s_count = S_BIAS;
77 atomic_set(&s->s_active, 1); 83 atomic_set(&s->s_active, 1);
@@ -295,7 +301,7 @@ retry:
295 } 301 }
296 if (!s) { 302 if (!s) {
297 spin_unlock(&sb_lock); 303 spin_unlock(&sb_lock);
298 s = alloc_super(); 304 s = alloc_super(type);
299 if (!s) 305 if (!s)
300 return ERR_PTR(-ENOMEM); 306 return ERR_PTR(-ENOMEM);
301 goto retry; 307 goto retry;