From 564427be4ef1615e0b386007f5adbcbc12887e24 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 22 Feb 2010 14:18:32 +1030 Subject: [PATCH] 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 --- ccan/tdb/tdb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccan/tdb/tdb.c b/ccan/tdb/tdb.c index 2da44282..ede00275 100644 --- a/ccan/tdb/tdb.c +++ b/ccan/tdb/tdb.c @@ -59,14 +59,14 @@ static void tdb_increment_seqnum(struct tdb_context *tdb) 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; } 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) -- 2.39.2