X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ffree.c;h=9c2bcac70e5366ad44e3d7240091abbb923a85f6;hp=be9b18455342a76ee316f98eff4363ade141849e;hb=838db0d7ea37fc2a21d03d159b55b042f8144cb3;hpb=f6900d2358ca0ec2f2dc776b9e42e4fca7bffbdf;ds=sidebyside diff --git a/ccan/tdb2/free.c b/ccan/tdb2/free.c index be9b1845..9c2bcac7 100644 --- a/ccan/tdb2/free.c +++ b/ccan/tdb2/free.c @@ -370,8 +370,10 @@ static tdb_len_t coalesce(struct tdb_context *tdb, } /* Did we just mess up a record you were hoping to use? */ - if (end == *protect) + if (end == *protect) { + tdb->stats.alloc_coalesce_iterate_clash++; *protect = TDB_ERR_NOEXIST; + } ecode = remove_from_list(tdb, nb_off, end, &rec); check_list(tdb, nb_off); @@ -390,8 +392,10 @@ static tdb_len_t coalesce(struct tdb_context *tdb, return 0; /* Before we expand, check this isn't one you wanted protected? */ - if (off == *protect) + if (off == *protect) { *protect = TDB_ERR_EXISTS; + tdb->stats.alloc_coalesce_iterate_clash++; + } /* OK, expand initial record */ ecode = tdb_read_convert(tdb, off, &rec, sizeof(rec)); @@ -416,6 +420,7 @@ static tdb_len_t coalesce(struct tdb_context *tdb, ecode = add_free_record(tdb, off, end - off, TDB_LOCK_NOWAIT, false); if (ecode != TDB_SUCCESS) { /* Need to drop lock. Can't rely on anything stable. */ + tdb->stats.alloc_coalesce_lockfail++; *protect = TDB_ERR_CORRUPT; /* We have to drop this to avoid deadlocks, so make sure record