r23978: Merge r23161 from Samba3:
authorMichael Adam <obnox@samba.org>
Fri, 20 Jul 2007 14:52:47 +0000 (14:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:01:14 +0000 (15:01 -0500)
Add TDB_VOLATILE as open_flag to activate the per-hashchain dead record
optimization.
(This used to be commit 868cdb1781fe94afbc1658e72bf06de20193bcd7)

source4/lib/tdb/common/open.c
source4/lib/tdb/include/tdb.h

index 1985bb75f34efdf35121c976ae5f9752c74e2df2..eadb3fd2f37a305fe905c5acbba168a9e8a313ef 100644 (file)
@@ -164,6 +164,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));
index fb59911ebe533ea6299947391e75c9023fa6bffe..f3a0dbe7bf1c218c346f74eff5a5f3ae69ca3f52 100644 (file)
@@ -46,6 +46,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)