aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 299ee9df546f..94283d06cace 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2328,17 +2328,15 @@ int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks,
2328} 2328}
2329 2329
2330/* 2330/*
2331 * How many index/leaf blocks need to change/allocate to modify nrblocks? 2331 * How many index/leaf blocks need to change/allocate to add @extents extents?
2332 * 2332 *
2333 * if nrblocks are fit in a single extent (chunk flag is 1), then 2333 * If we add a single extent, then in the worse case, each tree level
2334 * in the worse case, each tree level index/leaf need to be changed 2334 * index/leaf need to be changed in case of the tree split.
2335 * if the tree split due to insert a new extent, then the old tree
2336 * index/leaf need to be updated too
2337 * 2335 *
2338 * If the nrblocks are discontiguous, they could cause 2336 * If more extents are inserted, they could cause the whole tree split more
2339 * the whole tree split more than once, but this is really rare. 2337 * than once, but this is really rare.
2340 */ 2338 */
2341int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk) 2339int ext4_ext_index_trans_blocks(struct inode *inode, int extents)
2342{ 2340{
2343 int index; 2341 int index;
2344 int depth; 2342 int depth;
@@ -2349,7 +2347,7 @@ int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
2349 2347
2350 depth = ext_depth(inode); 2348 depth = ext_depth(inode);
2351 2349
2352 if (chunk) 2350 if (extents <= 1)
2353 index = depth * 2; 2351 index = depth * 2;
2354 else 2352 else
2355 index = depth * 3; 2353 index = depth * 3;