Skip to content

Commit

Permalink
ext4: use 'sbi' instead of 'EXT4_SB(sb)'
Browse files Browse the repository at this point in the history
We could use 'sbi' instead of 'EXT4_SB(sb)' to make code more elegant.

Signed-off-by: Jun Piao <piaojun@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jun Piao authored and Theodore Ts'o committed Jan 11, 2018
1 parent 06f29cc commit 49598e0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions fs/ext4/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
blk = ext4_inode_table(sb, desc);
offset = blk - group_first_block;
next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group),
EXT4_B2C(sbi, offset + sbi->s_itb_per_group),
EXT4_B2C(sbi, offset));
if (next_zero_bit <
EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group))
EXT4_B2C(sbi, offset + sbi->s_itb_per_group))
/* bad bitmap for inode tables */
return blk;
return 0;
Expand Down
6 changes: 3 additions & 3 deletions fs/ext4/block_validity.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ int ext4_setup_system_zone(struct super_block *sb)
int ret;

if (!test_opt(sb, BLOCK_VALIDITY)) {
if (EXT4_SB(sb)->system_blks.rb_node)
if (sbi->system_blks.rb_node)
ext4_release_system_zone(sb);
return 0;
}
if (EXT4_SB(sb)->system_blks.rb_node)
if (sbi->system_blks.rb_node)
return 0;

for (i=0; i < ngroups; i++) {
Expand All @@ -173,7 +173,7 @@ int ext4_setup_system_zone(struct super_block *sb)
}

if (test_opt(sb, DEBUG))
debug_print_tree(EXT4_SB(sb));
debug_print_tree(sbi);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
/* Do this BEFORE marking the inode not in use or returning an error */
ext4_clear_inode(inode);

es = EXT4_SB(sb)->s_es;
es = sbi->s_es;
if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
ext4_error(sb, "reserved or nonexistent inode %lu", ino);
goto error_return;
Expand Down Expand Up @@ -1157,7 +1157,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
ext4_set_inode_state(inode, EXT4_STATE_NEW);

ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
ei->i_extra_isize = sbi->s_want_extra_isize;
ei->i_inline_off = 0;
if (ext4_has_feature_inline_data(sb))
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
Expand Down
14 changes: 7 additions & 7 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,10 +757,10 @@ void ext4_mb_generate_buddy(struct super_block *sb,
clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state));

period = get_cycles() - period;
spin_lock(&EXT4_SB(sb)->s_bal_lock);
EXT4_SB(sb)->s_mb_buddies_generated++;
EXT4_SB(sb)->s_mb_generation_time += period;
spin_unlock(&EXT4_SB(sb)->s_bal_lock);
spin_lock(&sbi->s_bal_lock);
sbi->s_mb_buddies_generated++;
sbi->s_mb_generation_time += period;
spin_unlock(&sbi->s_bal_lock);
}

static void mb_regenerate_buddy(struct ext4_buddy *e4b)
Expand Down Expand Up @@ -1447,7 +1447,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
ext4_fsblk_t blocknr;

blocknr = ext4_group_first_block_no(sb, e4b->bd_group);
blocknr += EXT4_C2B(EXT4_SB(sb), block);
blocknr += EXT4_C2B(sbi, block);
ext4_grp_locked_error(sb, e4b->bd_group,
inode ? inode->i_ino : 0,
blocknr,
Expand Down Expand Up @@ -4838,9 +4838,9 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
if (in_range(ext4_block_bitmap(sb, gdp), block, count) ||
in_range(ext4_inode_bitmap(sb, gdp), block, count) ||
in_range(block, ext4_inode_table(sb, gdp),
EXT4_SB(sb)->s_itb_per_group) ||
sbi->s_itb_per_group) ||
in_range(block + count - 1, ext4_inode_table(sb, gdp),
EXT4_SB(sb)->s_itb_per_group)) {
sbi->s_itb_per_group)) {

ext4_error(sb, "Freeing blocks in system zone - "
"Block = %llu, count = %lu", block, count);
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ static int ext4_flex_group_add(struct super_block *sb,
goto exit_journal;

group = flex_gd->groups[0].group;
BUG_ON(group != EXT4_SB(sb)->s_groups_count);
BUG_ON(group != sbi->s_groups_count);
err = ext4_add_new_descs(handle, sb, group,
resize_inode, flex_gd->count);
if (err)
Expand Down
6 changes: 3 additions & 3 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,7 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb,
* compensate.
*/
if (sb->s_blocksize == 1024 && nr == 0 &&
le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) == 0)
le32_to_cpu(sbi->s_es->s_first_data_block) == 0)
has_super++;

return (has_super + ext4_group_first_block_no(sb, bg));
Expand Down Expand Up @@ -3122,7 +3122,7 @@ int ext4_register_li_request(struct super_block *sb,
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_li_request *elr = NULL;
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
ext4_group_t ngroups = sbi->s_groups_count;
int ret = 0;

mutex_lock(&ext4_li_mtx);
Expand Down Expand Up @@ -4837,7 +4837,7 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
bool needs_barrier = false;
struct ext4_sb_info *sbi = EXT4_SB(sb);

if (unlikely(ext4_forced_shutdown(EXT4_SB(sb))))
if (unlikely(ext4_forced_shutdown(sbi)))
return 0;

trace_ext4_sync_fs(sb, wait);
Expand Down

0 comments on commit 49598e0

Please sign in to comment.