@@ -2405,9 +2405,10 @@ int ext4_ext_index_trans_blocks(struct inode *inode, int extents)
depth = ext_depth(inode);
if (extents <= 1)
- index = depth * 2;
+ index = depth * 2 + extents;
else
- index = depth * 3;
+ index = depth * 3 +
+ DIV_ROUND_UP(extents, ext4_ext_space_block(inode, 0));
return index;
}
@@ -5687,7 +5687,7 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
* Now let's see how many group bitmaps and group descriptors need
* to account
*/
- groups = idxblocks + pextents;
+ groups = idxblocks;
gdpblocks = groups;
if (groups > ngroups)
groups = ngroups;