tdb: defragment the freelist in tdb_allocate_from_freelist()
authorMichael Adam <obnox@samba.org>
Wed, 11 Jun 2014 10:05:57 +0000 (12:05 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 26 Jun 2014 10:16:03 +0000 (12:16 +0200)
commit55ff3a3b912a911cb33b47f55be2966fbbbde2d8
treeef1113d0f8c0d80379af00c5a11c35107165aa97
parent6502df58391cc8d3477d1c5cce4a6aa027d439bd
tdb: defragment the freelist in tdb_allocate_from_freelist()

While we are traversing the freelist anyways, merge a record
with the left if it is also a free list record.

That partially makes up for the fragmentation introduced by
the lack of merging with right records in tdb_free().

Note there is a potential slight downside:
If the left record we merge the current record into was earlier
in the chain and has hence already been met in traverse,
then we can not use the enlarged record even if it might be
a new best fit.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun 26 12:16:03 CEST 2014 on sn-devel-104
lib/tdb/common/freelist.c