summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-04-05 10:12:21 +0000
committeravg <avg@FreeBSD.org>2010-04-05 10:12:21 +0000
commitf7959704e83bba31ecc6a41b47debe49a731d17a (patch)
treeceb9c1c4ce36b3489dcdfaffe7b5c3cfa27f7322 /lib/libc/db
parent75f42004bfb8917a4ba9846a4110d95c7b757c31 (diff)
downloadFreeBSD-src-f7959704e83bba31ecc6a41b47debe49a731d17a.zip
FreeBSD-src-f7959704e83bba31ecc6a41b47debe49a731d17a.tar.gz
libc/db/hash: cap auto-tuned block size with a value that actually works
This fix mostly matters after r206129 that made it possible for st_blksize to be greater than 4K. For this reason, this change should be MFC-ed before r206129. Also, it seems that all FreeBSD uitlities that use db(3) hash databases and create new databases in files, specify their own block size value and thus do not depend on block size autotuning. PR: bin/144446 Submitted by: Peter Jeremy <peterjeremy@acm.org> MFC after: 5 days
Diffstat (limited to 'lib/libc/db')
-rw-r--r--lib/libc/db/hash/hash.c2
-rw-r--r--lib/libc/db/hash/hash.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 83d2657..638814c 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -293,6 +293,8 @@ init_hash(HTAB *hashp, const char *file, const HASHINFO *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 8329413..cd11a3a 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 */
OpenPOWER on IntegriCloud