From: Johann Lombardi Date: Thu, 7 Dec 2006 04:40:46 +0000 (-0800) Subject: [PATCH] ext4: fix credit calculation in ext4_ext_calc_credits_for_insert X-Git-Tag: v3.12-rc1~32283^2~14^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=feb189274638ea357750a9e809f5a6e2223a082e;p=kernel%2Fkernel-generic.git [PATCH] ext4: fix credit calculation in ext4_ext_calc_credits_for_insert 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 Signed-off-by: Alex Tomas Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 1442ccb..994a6e4 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -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;