aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nvi/18dbpagesize_binpower.patch
blob: ec0450472dffccd74431217e8ab26f88b682dad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From: <hesso@pool.math.tu-berlin.de>
Subject: Make sure that the pagesize passed to db__set_pagesize() is
a power of two.

--- nvi-1.81.6.orig/common/exf.c	2009-03-09 01:48:01.695862889 +0100
+++ nvi-1.81.6/common/exf.c	2009-03-09 10:42:41.147866272 +0100
@@ -249,11 +249,10 @@
 		 * (vi should have good locality) or smaller than 1K.
 		 */
 		psize = ((sb.st_size / 15) + 1023) / 1024;
-		if (psize > 10)
-			psize = 10;
-		if (psize == 0)
-			psize = 1;
-		psize *= 1024;
+		if (psize >= 8) psize=8<<10;
+		else if (psize >= 4) psize=4<<10;
+		else if (psize >= 2) psize=2<<10;
+		else psize=1<<10;
 
 		F_SET(ep, F_DEVSET);
 		ep->mdev = sb.st_dev;