ext4: use ext4_group_first_block_no()
PATCH 1/4 ext4: use ext4_group_first_block_no()
Use ext4_group_first_block_no() and assign the return values to ext2_fsblk_t variables.
Signed-off-by Akinobu Mita <[email protected]>
Cc Stephen Tweedie <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Mingming Cao <[email protected]>
Cc Theodore Tso <[email protected]>
--- fs/ext4/balloc.c | 6 +++--- fs/ext4/xattr.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-)
fs/ext4/xattr.c +2 -4
@@ -808,10 +808,8 @@ inserted:get_bh (new_bh); }else {/* We need to allocate a new block */ -ext4_fsblk_t goal =le32_to_cpu ( -EXT4_SB (sb)->s_es->s_first_data_block) + - (ext4_fsblk_t )EXT4_I (inode)->i_block_group * -EXT4_BLOCKS_PER_GROUP (sb); +ext4_fsblk_t goal =ext4_group_first_block_no (sb, +EXT4_I (inode)->i_block_group);ext4_fsblk_t block =ext4_new_block (handle, inode, goal, &error);if (error)
fs/ext4/balloc.c +3 -3
@@ -48,7 +48,6 @@ void ext4_get_group_no_and_offset(structunsigned ext4_init_block_bitmap (struct super_block *sb,struct buffer_head *bh,ext4_group_t block_group,struct ext4_group_desc *gdp) { -unsigned long start;int bit, bit_max;unsigned free_blocks, group_blocks;struct ext4_sb_info *sbi =EXT4_SB (sb);
@@ -106,11 +105,12 @@ unsigned ext4_init_block_bitmap(struct s free_blocks = group_blocks - bit_max;if (bh) { +ext4_fsblk_t start; +for (bit =0 ; bit < bit_max; bit++)ext4_set_bit (bit, bh->b_data); - start = block_group *EXT4_BLOCKS_PER_GROUP (sb) + -le32_to_cpu (sbi->s_es->s_first_data_block); + start =ext4_group_first_block_no (sb, block_group);/* Set bits for block and inode bitmaps, and inode table */ ext4_set_bit (ext4_block_bitmap (sb, gdp) - start, bh->b_data);
Quoted 3 lines · Akinobu Mita
Use
ext4_group_first_block_no()and assign the return values toext2_fsblk_tvariables.
Acked for ext2/3/4 patches(except a little typo in above change log:ext4_fsblk_t). ext4 patch is queued in ext4 patch queue
http://repo.or.cz/w/ext4-patch-queue.git
Mingming
Quoted 55 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Stephen Tweedie <[email protected]>Cc Andrew Morton <[email protected]>Cc Mingming Cao <[email protected]>Cc Theodore Tso <[email protected]>--- fs/ext4/balloc.c | 6 +++--- fs/ext4/xattr.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-)Index:
2.6-rc/fs/ext4/xattr.c
===================================================================fs/ext4/xattr.c +2
-4@@ -808,10 +808,8 @@ inserted:get_bh (new_bh); }else {/* We need to allocate a new block */ -ext4_fsblk_t goal =le32_to_cpu ( -EXT4_SB (sb)->s_es->s_first_data_block) + - (ext4_fsblk_t )EXT4_I (inode)->i_block_group * -EXT4_BLOCKS_PER_GROUP (sb); +ext4_fsblk_t goal =ext4_group_first_block_no (sb, +EXT4_I (inode)->i_block_group);ext4_fsblk_t block =ext4_new_block (handle, inode, goal, &error);if (error)Index:
2.6-rc/fs/ext4/balloc.c
===================================================================fs/ext4/balloc.c +3
-3@@ -48,7 +48,6 @@ void ext4_get_group_no_and_offset(structunsigned ext4_init_block_bitmap (struct super_block *sb,struct buffer_head *bh,ext4_group_t block_group,struct ext4_group_desc *gdp) { -unsigned long start;int bit, bit_max;unsigned free_blocks, group_blocks;struct ext4_sb_info *sbi =EXT4_SB (sb);@@ -106,11 +105,12 @@ unsigned ext4_init_block_bitmap(struct s free_blocks = group_blocks - bit_max;if (bh) { +ext4_fsblk_t start; +for (bit =0 ; bit < bit_max; bit++)ext4_set_bit (bit, bh->b_data); - start = block_group *EXT4_BLOCKS_PER_GROUP (sb) + -le32_to_cpu (sbi->s_es->s_first_data_block); + start =ext4_group_first_block_no (sb, block_group);/* Set bits for block and inode bitmaps, and inode table */ ext4_set_bit (ext4_block_bitmap (sb, gdp) - start, bh->b_data);