]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/check.c
tdb2: use counters to decide when to coalesce records.
[ccan] / ccan / tdb2 / check.c
index 88b86429cb97aed7a2486f53a7699626d7fc3041..52fb188764dfa0e2c85250e3658200db2fc67894 100644 (file)
@@ -533,11 +533,13 @@ static enum TDB_ERROR check_free_table(struct tdb_context *tdb,
 
                h = bucket_off(ftable_off, i);
                for (off = tdb_read_off(tdb, h); off; off = f.next) {
-                       if (!first)
-                               first = off;
                        if (TDB_OFF_IS_ERR(off)) {
                                return off;
                        }
+                       if (!first) {
+                               off &= TDB_OFF_MASK;
+                               first = off;
+                       }
                        ecode = tdb_read_convert(tdb, off, &f, sizeof(f));
                        if (ecode != TDB_SUCCESS) {
                                return ecode;