Changeset 745 for trunk/server/lib/tdb/common/traverse.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/lib/tdb/common/traverse.c
r647 r745 7 7 Copyright (C) Paul `Rusty' Russell 2000 8 8 Copyright (C) Jeremy Allison 2000-2003 9 9 10 10 ** NOTE! The following LGPL license applies to the tdb 11 11 ** library. This does NOT imply that all of Samba is released 12 12 ** under the LGPL 13 13 14 14 This library is free software; you can redistribute it and/or 15 15 modify it under the terms of the GNU Lesser General Public … … 45 45 hashes are used. In that case we spend most of our 46 46 time in tdb_brlock(), locking empty hash chains. 47 47 48 48 To avoid this, we do an unlocked pre-check to see 49 49 if the hash chain is empty before starting to look … … 53 53 lock, so instead we get the lock and re-fetch the 54 54 value below. 55 55 56 56 Notice that not doing this optimisation on the 57 57 first hash chain is critical. We must guarantee … … 63 63 could miss them anyway without this trick, so the 64 64 semantics don't change. 65 65 66 66 With a non-indexed ldb search this trick gains us a 67 67 factor of around 80 in speed on a linux 2.6.x … … 213 213 a write style traverse - temporarily marks the db read only 214 214 */ 215 int tdb_traverse_read(struct tdb_context *tdb,215 _PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb, 216 216 tdb_traverse_func fn, void *private_data) 217 217 { 218 219 218 struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK }; 220 219 int ret; … … 222 221 /* we need to get a read lock on the transaction lock here to 223 222 cope with the lock ordering semantics of solaris10 */ 224 if (tdb_transaction_lock(tdb, F_RDLCK )) {223 if (tdb_transaction_lock(tdb, F_RDLCK, TDB_LOCK_WAIT)) { 225 224 return -1; 226 225 } … … 231 230 tdb->traverse_read--; 232 231 233 tdb_transaction_unlock(tdb );232 tdb_transaction_unlock(tdb, F_RDLCK); 234 233 235 234 return ret; … … 243 242 alignment restrictions malloc gives you. 244 243 */ 245 int tdb_traverse(struct tdb_context *tdb,244 _PUBLIC_ int tdb_traverse(struct tdb_context *tdb, 246 245 tdb_traverse_func fn, void *private_data) 247 246 { … … 253 252 } 254 253 255 if (tdb_transaction_lock(tdb, F_WRLCK )) {254 if (tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_WAIT)) { 256 255 return -1; 257 256 } … … 262 261 tdb->traverse_write--; 263 262 264 tdb_transaction_unlock(tdb );263 tdb_transaction_unlock(tdb, F_WRLCK); 265 264 266 265 return ret; … … 269 268 270 269 /* find the first entry in the database and return its key */ 271 TDB_DATA tdb_firstkey(struct tdb_context *tdb)270 _PUBLIC_ TDB_DATA tdb_firstkey(struct tdb_context *tdb) 272 271 { 273 272 TDB_DATA key; … … 300 299 301 300 /* find the next entry in the database, returning its key */ 302 TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey)301 _PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) 303 302 { 304 303 uint32_t oldhash;
Note:
See TracChangeset
for help on using the changeset viewer.