[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[linux-lvm] [PATCH] calc_max_buckets bug



Hello everyone,

This is in both 2.4.x lvm and 2.6.x dm code, calc_max_buckets is broken
for 32bit machines with > 4GB of ram.  This leads to -ENOMEM errors
during snapshot creation.

The patch below just changes things to allocate 2MB worth of hash
buckets all the time.  Has anyone done benchmarking into how much cpu
time snapshots spend on hash table lookups?

-chris

Index: linux.24/drivers/md/lvm-snap.c
===================================================================
--- linux.24.orig/drivers/md/lvm-snap.c	2004-03-09 18:07:59.000000000 -0500
+++ linux.24/drivers/md/lvm-snap.c	2004-03-09 20:20:34.000000000 -0500
@@ -504,13 +504,9 @@ out:
 
 static int calc_max_buckets(void)
 {
-	unsigned long mem;
-
-	mem = num_physpages << PAGE_SHIFT;
-	mem /= 100;
-	mem *= 2;
+	/* use a fixed size of 2MB */
+	unsigned long mem = 2 * 1024 * 1024;
 	mem /= sizeof(struct list_head);
-
 	return mem;
 }
 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]