From 8b0482d98fc04b697d39346a47168d70b412cc9b Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Mon, 12 Apr 2010 21:13:03 +0000 Subject: MFC r206178: ibc/db/hash: cap auto-tuned block size --- lib/libc/db/hash/hash.c | 2 ++ lib/libc/db/hash/hash.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 6b71d4a7c30f..02a9c5849a44 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -309,6 +309,8 @@ init_hash(hashp, file, info) if (stat(file, &statbuf)) return (NULL); hashp->BSIZE = statbuf.st_blksize; + if (hashp->BSIZE > MAX_BSIZE) + hashp->BSIZE = MAX_BSIZE; hashp->BSHIFT = __log2(hashp->BSIZE); } diff --git a/lib/libc/db/hash/hash.h b/lib/libc/db/hash/hash.h index 66f86aa3d72c..70cca5b694df 100644 --- a/lib/libc/db/hash/hash.h +++ b/lib/libc/db/hash/hash.h @@ -118,7 +118,7 @@ typedef struct htab { /* Memory resident data structure */ /* * Constants */ -#define MAX_BSIZE 65536 /* 2^16 */ +#define MAX_BSIZE 32768 /* 2^15 but should be 65536 */ #define MIN_BUFFERS 6 #define MINHDRSIZE 512 #define DEF_BUFSIZE 65536 /* 64 K */ -- cgit v1.3