]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/back-bdb.h
Unify use of BDB lockers
[openldap] / servers / slapd / back-bdb / back-bdb.h
index 9173e6a13ccd74d7024b7058ef4906751666c8e1..534062b53d7d72c8989f614e6e5a3ceaef725581 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2006 The OpenLDAP Foundation.
+ * Copyright 2000-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -68,9 +68,9 @@ LDAP_BEGIN_DECL
 
 typedef struct bdb_idl_cache_entry_s {
        struct berval kstr;
-       ldap_pvt_thread_rdwr_t idl_entry_rwlock;
        ID      *idl;
        DB      *db;
+       int             idl_flags;
        struct bdb_idl_cache_entry_s* idl_lru_prev;
        struct bdb_idl_cache_entry_s* idl_lru_next;
 } bdb_idl_cache_entry_t;
@@ -94,6 +94,7 @@ typedef struct bdb_entry_info {
 #define        CACHE_ENTRY_LOADING     0x10
 #define        CACHE_ENTRY_WALKING     0x20
 #define        CACHE_ENTRY_ONELEVEL    0x40
+#define        CACHE_ENTRY_REFERENCED  0x80
 
        /*
         * remaining fields require backend cache lock to access
@@ -121,20 +122,21 @@ typedef struct bdb_entry_info {
 
 /* for the in-core cache of entries */
 typedef struct bdb_cache {
-       int             c_maxsize;
-       int             c_cursize;
-       int             c_minfree;
-       int             c_eiused;       /* EntryInfo's in use */
-       int             c_leaves;       /* EntryInfo leaf nodes */
-       EntryInfo       c_dntree;
        EntryInfo       *c_eifree;      /* free list */
-       Avlnode         *c_idtree;
+       Avlnode         *c_idtree;
        EntryInfo       *c_lruhead;     /* lru - add accessed entries here */
        EntryInfo       *c_lrutail;     /* lru - rem lru entries from here */
+       EntryInfo       c_dntree;
+       int             c_maxsize;
+       int             c_cursize;
+       int             c_minfree;
+       int             c_eiused;       /* EntryInfo's in use */
+       int             c_leaves;       /* EntryInfo leaf nodes */
        ldap_pvt_thread_rdwr_t c_rwlock;
        ldap_pvt_thread_mutex_t lru_head_mutex;
        ldap_pvt_thread_mutex_t lru_tail_mutex;
-       u_int32_t       c_locker;       /* used by lru cleaner */
+       ldap_pvt_thread_mutex_t c_count_mutex;
+       ldap_pvt_thread_mutex_t c_eifree_mutex;
 #ifdef SLAP_ZONE_ALLOC
        void *c_zctx;
 #endif
@@ -150,12 +152,12 @@ struct bdb_db_info {
        DB                      *bdi_db;
 };
 
-typedef struct bdb_monitor_cleanup_t {
+typedef struct bdb_monitor_t {
        void            *bdm_cb;
-       struct berval   bdm_base;
+       struct berval   bdm_nbase;
        int             bdm_scope;
        struct berval   bdm_filter;
-} bdb_monitor_cleanup_t;
+} bdb_monitor_t;
 
 /* From ldap_rq.h */
 struct re_s;
@@ -203,6 +205,7 @@ struct bdb_info {
        alock_info_t    bi_alock_info;
        char            *bi_db_config_path;
        BerVarray       bi_db_config;
+       bdb_monitor_t   bi_monitor;
        int             bi_flags;
 #define        BDB_IS_OPEN             0x01
 #define        BDB_HAS_CONFIG  0x02
@@ -213,7 +216,6 @@ struct bdb_info {
        int             bi_modrdns;             /* number of modrdns completed */
        ldap_pvt_thread_mutex_t bi_modrdns_mutex;
 #endif
-       bdb_monitor_cleanup_t   bi_monitor_cleanup;
 };
 
 #define bi_id2entry    bi_databases[BDB_ID2ENTRY]
@@ -271,6 +273,10 @@ struct bdb_op_info {
 
 #endif
 
+#ifndef DB_BUFFER_SMALL
+#define DB_BUFFER_SMALL                        ENOMEM
+#endif
+
 #define BDB_REUSE_LOCKERS
 
 #define BDB_CSN_COMMIT 0