From: Volker Lendecke Date: Sun, 27 May 2007 09:22:11 +0000 (+0000) Subject: r23161: Add TDB_VOLATILE as open_flag to activate the per-hashchain dead record X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~350 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=945f73fa39ba6f2b637379ac20d52b4d0306d77f r23161: Add TDB_VOLATILE as open_flag to activate the per-hashchain dead record optimization. --- diff --git a/source/lib/tdb/common/open.c b/source/lib/tdb/common/open.c index c7fd3f66564..798395cba22 100644 --- a/source/lib/tdb/common/open.c +++ b/source/lib/tdb/common/open.c @@ -165,6 +165,10 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } + if (open_flags & TDB_VOLATILE) { + tdb->max_dead_records = 5; + } + if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", name)); diff --git a/source/lib/tdb/include/tdb.h b/source/lib/tdb/include/tdb.h index dafe2a130ec..3268a3bfa04 100644 --- a/source/lib/tdb/include/tdb.h +++ b/source/lib/tdb/include/tdb.h @@ -47,6 +47,7 @@ extern "C" { #define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ #define TDB_NOSYNC 64 /* don't use synchronous transactions */ #define TDB_SEQNUM 128 /* maintain a sequence number */ +#define TDB_VOLATILE 256 /* Activate the per-hashchain freelist, default 5 */ #define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)