Linux LVM users
 help / color / mirror / Atom feed
* [linux-lvm] [PATCH] calc_max_buckets bug
@ 2004-03-10  9:07 Chris Mason
  2004-03-10 10:42 ` Joe Thornber
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Mason @ 2004-03-10  9:07 UTC (permalink / raw)
  To: linux-lvm

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-11  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-10  9:07 [linux-lvm] [PATCH] calc_max_buckets bug Chris Mason
2004-03-10 10:42 ` Joe Thornber
2004-03-10 13:13   ` Chris Mason
2004-03-11  4:14     ` Joe Thornber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox