From owner-svn-src-all@FreeBSD.ORG Mon Apr 5 10:12:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CD34106566B; Mon, 5 Apr 2010 10:12:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7388FC15; Mon, 5 Apr 2010 10:12:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o35ACLqo096655; Mon, 5 Apr 2010 10:12:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o35ACLYD096652; Mon, 5 Apr 2010 10:12:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201004051012.o35ACLYD096652@svn.freebsd.org> From: Andriy Gapon Date: Mon, 5 Apr 2010 10:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206178 - head/lib/libc/db/hash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2010 10:12:21 -0000 Author: avg Date: Mon Apr 5 10:12:21 2010 New Revision: 206178 URL: http://svn.freebsd.org/changeset/base/206178 Log: 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 MFC after: 5 days Modified: head/lib/libc/db/hash/hash.c head/lib/libc/db/hash/hash.h Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Mon Apr 5 10:01:53 2010 (r206177) +++ head/lib/libc/db/hash/hash.c Mon Apr 5 10:12:21 2010 (r206178) @@ -293,6 +293,8 @@ init_hash(HTAB *hashp, const char *file, 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); } Modified: head/lib/libc/db/hash/hash.h ============================================================================== --- head/lib/libc/db/hash/hash.h Mon Apr 5 10:01:53 2010 (r206177) +++ head/lib/libc/db/hash/hash.h Mon Apr 5 10:12:21 2010 (r206178) @@ -118,7 +118,7 @@ typedef struct htab { /* Memory reside /* * 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 */