2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 2000-2002
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id$";
14
#ifndef NO_SYSTEM_INCLUDES
15
#include <sys/types.h>
27
* Compute if we have enough cache.
29
* PUBLIC: int __db_util_cache __P((DB_ENV *, DB *, u_int32_t *, int *));
32
__db_util_cache(dbenv, dbp, cachep, resizep)
47
* The current cache size is in cachep. If it's insufficient, set the
48
* the memory referenced by resizep to 1 and set cachep to the minimum
51
if ((ret = dbp->get_type(dbp, &type)) != 0) {
52
dbenv->err(dbenv, ret, "DB->get_type");
56
if ((ret = dbp->stat(dbp, &sp, DB_FAST_STAT)) != 0) {
57
dbenv->err(dbenv, ret, "DB->stat");
63
qsp = (DB_QUEUE_STAT *)sp;
64
pgsize = qsp->qs_pagesize;
67
hsp = (DB_HASH_STAT *)sp;
68
pgsize = hsp->hash_pagesize;
72
bsp = (DB_BTREE_STAT *)sp;
73
pgsize = bsp->bt_pagesize;
76
dbenv->err(dbenv, ret, "unknown database type: %d", type);
82
* Make sure our current cache is big enough. We want at least
83
* DB_MINPAGECACHE pages in the cache.
85
if ((*cachep / pgsize) < DB_MINPAGECACHE) {
87
*cachep = pgsize * DB_MINPAGECACHE;