Browse Source

tdb: use tdb_nest_lock() for seqnum lock.

This is pure overhead, but it centralizes the locking.  Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 16 years ago
parent
commit
564427be4e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      ccan/tdb/tdb.c

+ 3 - 3
ccan/tdb/tdb.c

@@ -59,14 +59,14 @@ static void tdb_increment_seqnum(struct tdb_context *tdb)
 		return;
 		return;
 	}
 	}
 
 
-	if (tdb_brlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1,
-		       TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
+	if (tdb_nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK,
+			  TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
 		return;
 		return;
 	}
 	}
 
 
 	tdb_increment_seqnum_nonblock(tdb);
 	tdb_increment_seqnum_nonblock(tdb);
 
 
-	tdb_brunlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1);
+	tdb_nest_unlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, false);
 }
 }
 
 
 static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)
 static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)