p = tdb_get(tdb, off, &pad, sizeof(pad));
if (!p)
return TDB_OFF_ERR;
- if (frec_magic(&p->f) == TDB_FREE_MAGIC) {
+ if (frec_magic(&p->f) == TDB_FREE_MAGIC
+ || frec_magic(&p->f) == TDB_COALESCING_MAGIC) {
if (frec_zone_bits(&p->f) != zhdr.zone_bits) {
tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
"tdb_check: Bad free zone bits %u"
(long long)off);
return TDB_OFF_ERR;
}
- /* This record is free! */
- if (!append(free, num_free, off))
- return TDB_OFF_ERR;
len = sizeof(p->u) + p->f.data_len;
if (off + len > zone_off + (1ULL << zhdr.zone_bits)) {
tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
(long long)len, (long long)off);
return TDB_OFF_ERR;
}
+ /* This record is free! */
+ if (frec_magic(&p->f) == TDB_FREE_MAGIC
+ && !append(free, num_free, off))
+ return TDB_OFF_ERR;
} else {
uint64_t klen, dlen, extra;
#define TDB_VERSION ((uint64_t)(0x26011967 + 7))
#define TDB_MAGIC ((uint64_t)0x1999)
#define TDB_FREE_MAGIC ((~(uint64_t)TDB_MAGIC) << 6)
+#define TDB_COALESCING_MAGIC (0xBAD1DEA2FEEDULL << 6)
#define TDB_HASH_MAGIC (0xA1ABE11A01092008ULL)
#define TDB_RECOVERY_MAGIC (0xf53bc0e7U)
#define TDB_RECOVERY_INVALID_MAGIC (0x0)
p = tdb_get(tdb, off, &pad, sizeof(pad));
if (!p)
return TDB_OFF_ERR;
- if (frec_magic(&p->f) == TDB_FREE_MAGIC) {
+ if (rec_magic(&p->u) != TDB_MAGIC) {
len = p->f.data_len;
tally_add(free, len);
bucketlen[size_to_bucket(frec_zone_bits(&p->f), len)]++;