[PATCH] calc_max_buckets bug

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

 



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;
 }
 


_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux