aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/balloc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index a4950e91f61c..59c3ba8bb8ea 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -307,6 +307,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
307 ext4_group_t block_group, 307 ext4_group_t block_group,
308 struct buffer_head *bh) 308 struct buffer_head *bh)
309{ 309{
310 struct ext4_sb_info *sbi = EXT4_SB(sb);
310 ext4_grpblk_t offset; 311 ext4_grpblk_t offset;
311 ext4_grpblk_t next_zero_bit; 312 ext4_grpblk_t next_zero_bit;
312 ext4_fsblk_t blk; 313 ext4_fsblk_t blk;
@@ -326,14 +327,14 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
326 /* check whether block bitmap block number is set */ 327 /* check whether block bitmap block number is set */
327 blk = ext4_block_bitmap(sb, desc); 328 blk = ext4_block_bitmap(sb, desc);
328 offset = blk - group_first_block; 329 offset = blk - group_first_block;
329 if (!ext4_test_bit(offset, bh->b_data)) 330 if (!ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
330 /* bad block bitmap */ 331 /* bad block bitmap */
331 return blk; 332 return blk;
332 333
333 /* check whether the inode bitmap block number is set */ 334 /* check whether the inode bitmap block number is set */
334 blk = ext4_inode_bitmap(sb, desc); 335 blk = ext4_inode_bitmap(sb, desc);
335 offset = blk - group_first_block; 336 offset = blk - group_first_block;
336 if (!ext4_test_bit(offset, bh->b_data)) 337 if (!ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
337 /* bad block bitmap */ 338 /* bad block bitmap */
338 return blk; 339 return blk;
339 340
@@ -341,9 +342,10 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
341 blk = ext4_inode_table(sb, desc); 342 blk = ext4_inode_table(sb, desc);
342 offset = blk - group_first_block; 343 offset = blk - group_first_block;
343 next_zero_bit = ext4_find_next_zero_bit(bh->b_data, 344 next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
344 offset + EXT4_SB(sb)->s_itb_per_group, 345 EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group),
345 offset); 346 EXT4_B2C(sbi, offset));
346 if (next_zero_bit < offset + EXT4_SB(sb)->s_itb_per_group) 347 if (next_zero_bit <
348 EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group))
347 /* bad bitmap for inode tables */ 349 /* bad bitmap for inode tables */
348 return blk; 350 return blk;
349 return 0; 351 return 0;