Skip to contentSkip to conversation

ext4: fix credit calculation in ext4_ext_calc_credits_for_insert

PATCH New Johann Lombardi 1 participant 1 message Dec 4, 2006 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: fix credit calculation in ext4_ext_calc_credits_for_insert

Hello,

The patch below fixes a nit in ext4_ext_calc_credits_for_insert(). Besides, credits for the new root are already added in the index split accounting.

Johann

---

fs/ext4/extents.c +4 -3
Index: linux-2.6.19/fs/ext4/extents.c
===================================================================
@@ -1534,16 +1534,17 @@ int inline ext4_ext_calc_credits_for_ins
 
 	/*
 	 * 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;