Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d00a6d7b authored by Akinobu Mita's avatar Akinobu Mita Committed by Theodore Ts'o
Browse files

ext4: use ext4_group_first_block_no()



Use ext4_group_first_block_no() and assign the return values to
ext4_fsblk_t variables.

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: adilger@clusterfs.com
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mingming Cao <cmm@us.ibm.com>
parent 216c34b2
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
		 ext4_group_t block_group, struct ext4_group_desc *gdp)
		 ext4_group_t block_group, struct ext4_group_desc *gdp)
{
{
	unsigned long start;
	int bit, bit_max;
	int bit, bit_max;
	unsigned free_blocks, group_blocks;
	unsigned free_blocks, group_blocks;
	struct ext4_sb_info *sbi = EXT4_SB(sb);
	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -106,11 +105,12 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
	free_blocks = group_blocks - bit_max;
	free_blocks = group_blocks - bit_max;


	if (bh) {
	if (bh) {
		ext4_fsblk_t start;

		for (bit = 0; bit < bit_max; bit++)
		for (bit = 0; bit < bit_max; bit++)
			ext4_set_bit(bit, bh->b_data);
			ext4_set_bit(bit, bh->b_data);


		start = block_group * EXT4_BLOCKS_PER_GROUP(sb) +
		start = ext4_group_first_block_no(sb, block_group);
			le32_to_cpu(sbi->s_es->s_first_data_block);


		/* Set bits for block and inode bitmaps, and inode table */
		/* Set bits for block and inode bitmaps, and inode table */
		ext4_set_bit(ext4_block_bitmap(sb, gdp) - start, bh->b_data);
		ext4_set_bit(ext4_block_bitmap(sb, gdp) - start, bh->b_data);
+2 −4
Original line number Original line Diff line number Diff line
@@ -806,10 +806,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
			get_bh(new_bh);
			get_bh(new_bh);
		} else {
		} else {
			/* We need to allocate a new block */
			/* We need to allocate a new block */
			ext4_fsblk_t goal = le32_to_cpu(
			ext4_fsblk_t goal = ext4_group_first_block_no(sb,
					EXT4_SB(sb)->s_es->s_first_data_block) +
						EXT4_I(inode)->i_block_group);
				(ext4_fsblk_t)EXT4_I(inode)->i_block_group *
				EXT4_BLOCKS_PER_GROUP(sb);
			ext4_fsblk_t block = ext4_new_block(handle, inode,
			ext4_fsblk_t block = ext4_new_block(handle, inode,
							goal, &error);
							goal, &error);
			if (error)
			if (error)