-
- /* Coalescing across two zones isn't possible. */
- layout = new_tdb_layout(NULL);
- tdb_layout_add_zone(layout, zone_bits, false);
- tdb_layout_add_zone(layout, zone_bits, true);
- tdb = tdb_layout_get(layout);
- zone_off = layout->elem[0].base.off;
- len = layout->elem[1].free.len;
- ok1(free_record_length(tdb, layout->elem[1].base.off) == len);
- ok1(tdb_check(tdb, NULL, NULL) == 0);
-
- /* Figure out which list free entry is. */
- b_off = bucket_off(zone_off, size_to_bucket(zone_bits, len));
- /* Lock and coalesce. */
- ok1(tdb_lock_free_bucket(tdb, b_off, TDB_LOCK_WAIT) == 0);
- ok1(coalesce(tdb, zone_off, zone_bits, layout->elem[1].base.off,
- b_off, len) == 0);
- tdb_unlock_free_bucket(tdb, b_off);
- ok1(!tdb_has_locks(tdb));
- ok1(free_record_length(tdb, layout->elem[1].base.off) == len);
- ok1(tdb_check(tdb, NULL, NULL) == 0);
- tdb_close(tdb);