aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Minet <vincent@vincent-minet.net>2009-05-15 08:33:18 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-05-15 08:33:18 -0400
commitbc8e67409ccdcff72c3f1656b1fb1aad7ff396db (patch)
tree2a766e3c7bc938b697499aa7d5a20f2f468b5a2f
parent955ce5f5be67dfe0d1d096b543af33fe8a1ce3dd (diff)
ext4: Fix spinlock assertions on UP systems
On UP systems without DEBUG_SPINLOCK, ext4_is_group_locked always fails which triggers a BUG_ON() call. This patch fixes it by using assert_spin_locked instead. Signed-off-by: Vincent Minet <vincent@vincent-minet.net> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h6
-rw-r--r--fs/ext4/mballoc.c10
2 files changed, 5 insertions, 11 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 149e02dc3606..89190ae671f6 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1583,12 +1583,6 @@ static inline void ext4_unlock_group(struct super_block *sb,
1583 spin_unlock(ext4_group_lock_ptr(sb, group)); 1583 spin_unlock(ext4_group_lock_ptr(sb, group));
1584} 1584}
1585 1585
1586static inline int ext4_is_group_locked(struct super_block *sb,
1587 ext4_group_t group)
1588{
1589 return spin_is_locked(ext4_group_lock_ptr(sb, group));
1590}
1591
1592/* 1586/*
1593 * Inodes and files operations 1587 * Inodes and files operations
1594 */ 1588 */
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e76459cedcdb..541bd9adffa2 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -436,7 +436,7 @@ static void mb_free_blocks_double(struct inode *inode, struct ext4_buddy *e4b,
436 436
437 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) 437 if (unlikely(e4b->bd_info->bb_bitmap == NULL))
438 return; 438 return;
439 BUG_ON(!ext4_is_group_locked(sb, e4b->bd_group)); 439 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
440 for (i = 0; i < count; i++) { 440 for (i = 0; i < count; i++) {
441 if (!mb_test_bit(first + i, e4b->bd_info->bb_bitmap)) { 441 if (!mb_test_bit(first + i, e4b->bd_info->bb_bitmap)) {
442 ext4_fsblk_t blocknr; 442 ext4_fsblk_t blocknr;
@@ -460,7 +460,7 @@ static void mb_mark_used_double(struct ext4_buddy *e4b, int first, int count)
460 460
461 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) 461 if (unlikely(e4b->bd_info->bb_bitmap == NULL))
462 return; 462 return;
463 BUG_ON(!ext4_is_group_locked(e4b->bd_sb, e4b->bd_group)); 463 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group));
464 for (i = 0; i < count; i++) { 464 for (i = 0; i < count; i++) {
465 BUG_ON(mb_test_bit(first + i, e4b->bd_info->bb_bitmap)); 465 BUG_ON(mb_test_bit(first + i, e4b->bd_info->bb_bitmap));
466 mb_set_bit(first + i, e4b->bd_info->bb_bitmap); 466 mb_set_bit(first + i, e4b->bd_info->bb_bitmap);
@@ -1115,7 +1115,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
1115 struct super_block *sb = e4b->bd_sb; 1115 struct super_block *sb = e4b->bd_sb;
1116 1116
1117 BUG_ON(first + count > (sb->s_blocksize << 3)); 1117 BUG_ON(first + count > (sb->s_blocksize << 3));
1118 BUG_ON(!ext4_is_group_locked(sb, e4b->bd_group)); 1118 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
1119 mb_check_buddy(e4b); 1119 mb_check_buddy(e4b);
1120 mb_free_blocks_double(inode, e4b, first, count); 1120 mb_free_blocks_double(inode, e4b, first, count);
1121 1121
@@ -1196,7 +1196,7 @@ static int mb_find_extent(struct ext4_buddy *e4b, int order, int block,
1196 int ord; 1196 int ord;
1197 void *buddy; 1197 void *buddy;
1198 1198
1199 BUG_ON(!ext4_is_group_locked(e4b->bd_sb, e4b->bd_group)); 1199 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group));
1200 BUG_ON(ex == NULL); 1200 BUG_ON(ex == NULL);
1201 1201
1202 buddy = mb_find_buddy(e4b, order, &max); 1202 buddy = mb_find_buddy(e4b, order, &max);
@@ -1260,7 +1260,7 @@ static int mb_mark_used(struct ext4_buddy *e4b, struct ext4_free_extent *ex)
1260 1260
1261 BUG_ON(start + len > (e4b->bd_sb->s_blocksize << 3)); 1261 BUG_ON(start + len > (e4b->bd_sb->s_blocksize << 3));
1262 BUG_ON(e4b->bd_group != ex->fe_group); 1262 BUG_ON(e4b->bd_group != ex->fe_group);
1263 BUG_ON(!ext4_is_group_locked(e4b->bd_sb, e4b->bd_group)); 1263 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group));
1264 mb_check_buddy(e4b); 1264 mb_check_buddy(e4b);
1265 mb_mark_used_double(e4b, start, len); 1265 mb_mark_used_double(e4b, start, len);
1266 1266