X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb%2Ffreelist.c;h=3bc3965141b605ba5ad62f918e156e9deece9aed;hb=ccce1aa254cb9c7a2796e3171c7146703ab7ae40;hp=2f2a4c379b0690399a9f4065b15960e667300bf0;hpb=7104b7bc2e7f9829891477dbb04a9df926a656a7;p=ccan diff --git a/ccan/tdb/freelist.c b/ccan/tdb/freelist.c index 2f2a4c37..3bc39651 100644 --- a/ccan/tdb/freelist.c +++ b/ccan/tdb/freelist.c @@ -284,6 +284,9 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st if (tdb_lock(tdb, -1, F_WRLCK) == -1) return 0; + /* over-allocate to reduce fragmentation */ + length *= 1.25; + /* Extra bytes required for tailer */ length += sizeof(tdb_off_t); length = TDB_ALIGN(length, TDB_ALIGNMENT);