diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-17 12:26:13 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-17 12:26:13 +1030 |
commit | 5d9de604d92d227899e9b861c6beafb2e4fa61e0 (patch) | |
tree | 334095e99e3635f22d8783bd0343810b16507aee /lib/tdb/common/transaction.c | |
parent | e9114a758538d460d4f9deae5ce631bf44b1eff8 (diff) | |
download | samba-5d9de604d92d227899e9b861c6beafb2e4fa61e0.tar.gz samba-5d9de604d92d227899e9b861c6beafb2e4fa61e0.tar.bz2 samba-5d9de604d92d227899e9b861c6beafb2e4fa61e0.zip |
tdb: cleanup: tdb_nest_lock/tdb_nest_unlock
Because fcntl locks don't nest, we track them in the tdb->lockrecs array
and only place/release them when the count goes to 1/0. We only do this
for record locks, so we simply place the list number (or -1 for the free
list) in the structure.
To generalize this:
1) Put the offset rather than list number in struct tdb_lock_type.
2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the
allrecord check out to the callers (except the mark case which doesn't
care).
3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and
move the allrecord out to the callers (except mark again).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb/common/transaction.c')
-rw-r--r-- | lib/tdb/common/transaction.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index e72eff5b1f..374c597d8d 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -631,7 +631,7 @@ static int _tdb_transaction_cancel(struct tdb_context *tdb, int ltype) if (tdb->num_locks != 0) { for (i=0;i<tdb->num_lockrecs;i++) { tdb_brunlock(tdb, tdb->lockrecs[i].ltype, - FREELIST_TOP+4*tdb->lockrecs[i].list, 1); + tdb->lockrecs[i].off, 1); } tdb->num_locks = 0; tdb->num_lockrecs = 0; |