Skip to content

Commit

Permalink
[PATCH] ext4: fix credit calculation in ext4_ext_calc_credits_for_insert
Browse files Browse the repository at this point in the history
Fix a nit in ext4_ext_calc_credits_for_insert().  Besides, credits for the
new root are already added in the index split accounting.

Signed-off-by: Johann Lombardi <johann.lombardi@bull.net>
Signed-off-by: Alex Tomas <alex@clusterfs.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Johann Lombardi authored and Linus Torvalds committed Dec 7, 2006
1 parent 97d2a80 commit feb1892
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,16 +1531,17 @@ int inline ext4_ext_calc_credits_for_insert(struct inode *inode,

/*
* tree can be full, so it would need to grow in depth:
* allocation + old root + new root
* we need one credit to modify old root, credits for
* new root will be added in split accounting
*/
needed += 2 + 1 + 1;
needed += 1;

/*
* Index split can happen, we would need:
* allocate intermediate indexes (bitmap + group)
* + change two blocks at each level, but root (already included)
*/
needed = (depth * 2) + (depth * 2);
needed += (depth * 2) + (depth * 2);

/* any allocation modifies superblock */
needed += 1;
Expand Down

0 comments on commit feb1892

Please sign in to comment.