[Ocfs2-tools-devel] [PATCH 5/5] mkfs: Make 8 slots the default for most volume sizes

Sunil Mushran sunil.mushran at oracle.com
Wed Oct 8 16:05:47 PDT 2008


Patch updates the code that determines the default number of slots
for a volume. It now chooses 8 slots for volumes ranging from 10G to 1T.
Earlier the tool used to default to 4 slots. This change is long overdue
as the average size of the clusters is now greater than 4 nodes.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 mkfs.ocfs2/mkfs.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 06d4f6f..7d3ff60 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -2198,17 +2198,16 @@ close_device(State *s)
 static int
 initial_slots_for_volume(uint64_t size)
 {
-	int i, shift = ONE_GB_SHIFT;
-	int defaults[4] = { 2, 4, 8, 16 };
-
-	for (i = 0, shift = ONE_GB_SHIFT; i < 4; i++, shift += 3) {
-		size >>= shift;
-
-		if (!size)
-			break;
-	}
-
-	return (i < 4) ? defaults[i] : 32;
+	size >>= ONE_GB_SHIFT;
+
+	if (size < 2)
+		return 2;
+	else if (size < 10)
+		return 4;
+	else if (size < 1024)
+		return 8;
+	else
+		return 16;
 }
 
 static void
-- 
1.5.4.3




More information about the Ocfs2-tools-devel mailing list