From: Kurt Zeilenga Date: Tue, 29 Jan 2002 20:05:55 +0000 (+0000) Subject: Entry rwlock is no longer needed as concurrency is managed X-Git-Tag: LDBM_POST_GIANT_RWLOCK X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0eac91fcc7affeb68f2dcb5d3e08ed29d53c9e21;p=openldap Entry rwlock is no longer needed as concurrency is managed by the giant rwlock. --- diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 1a9f1c6fcf..b5aaaa2f37 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -19,7 +19,9 @@ /* LDBM backend specific entry info -- visible only to the cache */ typedef struct ldbm_entry_info { +#ifdef LDBM_ENTRY_RWLOCK ldap_pvt_thread_rdwr_t lei_rdwr; /* reader/writer lock */ +#endif /* * remaining fields require backend cache lock to access @@ -45,6 +47,7 @@ static int cache_delete_entry_internal(Cache *cache, Entry *e); static void lru_print(Cache *cache); #endif +#ifdef LDBM_ENTRY_RWLOCK static int cache_entry_rdwr_lock(Entry *e, int rw) { @@ -113,6 +116,7 @@ cache_entry_rdwr_destroy(Entry *e) { return ldap_pvt_thread_rdwr_destroy( &LEI(e)->lei_rdwr ); } +#endif static int cache_entry_private_init( Entry*e ) @@ -126,11 +130,13 @@ cache_entry_private_init( Entry*e ) e->e_private = ch_calloc(1, sizeof(struct ldbm_entry_info)); +#ifdef LDBM_ENTRY_RWLOCK if( cache_entry_rdwr_init( e ) != 0 ) { free( LEI(e) ); e->e_private = NULL; return 1; } +#endif return 0; } @@ -157,7 +163,9 @@ cache_entry_private_destroy( Entry*e ) { assert( e->e_private ); +#ifdef LDBM_ENTRY_RWLOCK cache_entry_rdwr_destroy( e ); +#endif free( e->e_private ); e->e_private = NULL; @@ -175,7 +183,9 @@ cache_return_entry_rw( Cache *cache, Entry *e, int rw ) assert( e->e_private ); +#ifdef LDBM_ENTRY_RWLOCK cache_entry_rdwr_unlock(e, rw); +#endif id = e->e_id; refcnt = --LEI(e)->lei_refcnt; @@ -367,8 +377,6 @@ cache_add_entry_rw( e->e_id, e->e_dn, 0 ); #endif - - /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, (AVL_CMP) entry_dn_cmp ) == NULL ) @@ -381,7 +389,6 @@ cache_add_entry_rw( Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n", 0, 0, 0 ); #endif - } cache_entry_private_destroy(e); @@ -391,7 +398,9 @@ cache_add_entry_rw( return( -1 ); } +#ifdef LDBM_ENTRY_RWLOCK cache_entry_rdwr_lock( e, rw ); +#endif /* put the entry into 'CREATING' state */ /* will be marked after when entry is returned */ @@ -711,6 +720,7 @@ try_again: goto try_again; } +#ifdef LDBM_ENTRY_RWLOCK /* acquire reader lock */ if ( cache_entry_rdwr_trylock(ep, rw) == LDAP_PVT_THREAD_EBUSY ) { /* could not acquire entry lock... @@ -735,6 +745,7 @@ try_again: ldap_pvt_thread_yield(); goto try_again; } +#endif /* lru */ LRU_DELETE( cache, ep );