aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2010-03-14 18:17:54 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-03-14 18:17:54 -0400
commitd330a5befb88875a9b3d2db62f9b74dadf660b13 (patch)
tree1d3d59cd0e35cf08519ecac6f086eb69f157cb20 /fs/ext4
parent57d54889cd00db2752994b389ba714138652e60c (diff)
ext4: Fix estimate of # of blocks needed to write indirect-mapped files
http://bugzilla.kernel.org/show_bug.cgi?id=15420 Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 986120f30066..11119e07233b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1035,7 +1035,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode,
1035 sector_t lblock) 1035 sector_t lblock)
1036{ 1036{
1037 struct ext4_inode_info *ei = EXT4_I(inode); 1037 struct ext4_inode_info *ei = EXT4_I(inode);
1038 int dind_mask = EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1; 1038 sector_t dind_mask = ~((sector_t)EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1);
1039 int blk_bits; 1039 int blk_bits;
1040 1040
1041 if (lblock < EXT4_NDIR_BLOCKS) 1041 if (lblock < EXT4_NDIR_BLOCKS)
@@ -1050,7 +1050,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode,
1050 } 1050 }
1051 ei->i_da_metadata_calc_last_lblock = lblock & dind_mask; 1051 ei->i_da_metadata_calc_last_lblock = lblock & dind_mask;
1052 ei->i_da_metadata_calc_len = 1; 1052 ei->i_da_metadata_calc_len = 1;
1053 blk_bits = roundup_pow_of_two(lblock + 1); 1053 blk_bits = order_base_2(lblock);
1054 return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1; 1054 return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1;
1055} 1055}
1056 1056