Subject: Re: libc/db/hash problem
To: None <current-users@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: current-users
Date: 12/11/2002 22:07:41
On Wed, Dec 11, 2002 at 12:42:56PM -0800, Greywolf wrote:
> On Wed, 11 Dec 2002, Juergen Hannken-Illjes wrote:
> 
> # > Curiously (bear with my lack of education), what would be the effect
> # > of increasing the bucket size?  Would this break things in a horrible
> # > way, or a horribly subtle way, or would it destroy compatibility,
> # > or is this something that will eventually need to be addressed anyway?
> #
> # This would be a DEcrease. Currently MAX_BSIZE is 65536 (2^16).
> 
> That wasn't my question.  Please re-read it. :)
> 
> "What would be the effect of increasing MAX_BSIZE (implying that the data
> sizes for the hash bucket would also be increased)?"

I dont know...

The problem I ran into is dev_mkdb creating a hash db with default
bucket size and this is the fs block size. I have not tried it yet
but I suppose the hash db would accept a fs block size of more than
64kB and loose ...

So my fix would be:
    lib/libc/db/hash/hash.h
	-  #define MAX_BSIZE 65536
	+  #define MAX_BSIZE 32768
    lib/libc/db/hash/hash.c
	   if (file != NULL) {
	   	if (stat(file, &statbuf))
	   		return (NULL);
	-  	hashp->BSIZE = statbuf.st_blksize;
	+	if (statbuf.st_blksize <= MAX_BSIZE)
	+		hashp->BSIZE = statbuf.st_blksize;
	+	else
	+		hashp->BSIZE = MAX_BSIZE;
	   	hashp->BSHIFT = __log2((u_int32_t)hashp->BSIZE);
	   }

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)