tdb: use tdb_nest_lock() for seqnum lock.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 17 Feb 2010 02:10:57 +0000 (12:40 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 17 Feb 2010 02:10:57 +0000 (12:40 +1030)
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>
lib/tdb/common/tdb.c

index ad81a56877f55d9cf711a4ad4e502fbfdb090093..7317a3aa521554c898d12a5e5b8f57c7dafea36f 100644 (file)
@@ -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;
        }
 
        tdb_increment_seqnum_nonblock(tdb);
 
                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)
 }
 
 static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)