aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2009-05-02 20:35:09 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-05-02 20:35:09 -0400
commit955ce5f5be67dfe0d1d096b543af33fe8a1ce3dd (patch)
tree68b0bdbef1594a3e43c1ef28ae8e096b40a06ae4 /fs/ext4/ext4.h
parenteefd7f03b86b8a319890e7fac5a6fcc7f8694b76 (diff)
ext4: Convert ext4_lock_group to use sb_bgl_lock
We have sb_bgl_lock() and ext4_group_info.bb_state bit spinlock to protech group information. The later is only used within mballoc code. Consolidate them to use sb_bgl_lock(). This makes the mballoc.c code much simpler and also avoid confusion with two locks protecting same info. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5973f3261b0c..149e02dc3606 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -963,12 +963,6 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
963 (ino >= EXT4_FIRST_INO(sb) && 963 (ino >= EXT4_FIRST_INO(sb) &&
964 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); 964 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
965} 965}
966
967static inline spinlock_t *
968sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group)
969{
970 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
971}
972#else 966#else
973/* Assume that user mode programs are passing in an ext4fs superblock, not 967/* Assume that user mode programs are passing in an ext4fs superblock, not
974 * a kernel struct super_block. This will allow us to call the feature-test 968 * a kernel struct super_block. This will allow us to call the feature-test
@@ -1568,33 +1562,31 @@ struct ext4_group_info {
1568}; 1562};
1569 1563
1570#define EXT4_GROUP_INFO_NEED_INIT_BIT 0 1564#define EXT4_GROUP_INFO_NEED_INIT_BIT 0
1571#define EXT4_GROUP_INFO_LOCKED_BIT 1
1572 1565
1573#define EXT4_MB_GRP_NEED_INIT(grp) \ 1566#define EXT4_MB_GRP_NEED_INIT(grp) \
1574 (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state))) 1567 (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
1575 1568
1576static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group) 1569static inline spinlock_t *ext4_group_lock_ptr(struct super_block *sb,
1570 ext4_group_t group)
1577{ 1571{
1578 struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); 1572 return bgl_lock_ptr(EXT4_SB(sb)->s_blockgroup_lock, group);
1573}
1579 1574
1580 bit_spin_lock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state)); 1575static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
1576{
1577 spin_lock(ext4_group_lock_ptr(sb, group));
1581} 1578}
1582 1579
1583static inline void ext4_unlock_group(struct super_block *sb, 1580static inline void ext4_unlock_group(struct super_block *sb,
1584 ext4_group_t group) 1581 ext4_group_t group)
1585{ 1582{
1586 struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); 1583 spin_unlock(ext4_group_lock_ptr(sb, group));
1587
1588 bit_spin_unlock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state));
1589} 1584}
1590 1585
1591static inline int ext4_is_group_locked(struct super_block *sb, 1586static inline int ext4_is_group_locked(struct super_block *sb,
1592 ext4_group_t group) 1587 ext4_group_t group)
1593{ 1588{
1594 struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); 1589 return spin_is_locked(ext4_group_lock_ptr(sb, group));
1595
1596 return bit_spin_is_locked(EXT4_GROUP_INFO_LOCKED_BIT,
1597 &(grinfo->bb_state));
1598} 1590}
1599 1591
1600/* 1592/*