From 3a2a755e3380a8f81374009d463cd06161352507 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 21 Dec 2011 14:17:16 +1030 Subject: tdb: use same expansion factor logic when expanding for new recovery area. If we're expanding because the current recovery area is too small, we expand only the amount we need. This can quickly lead to exponential growth when we have a slowly-expanding record (hence a slowly-expanding transaction size). Signed-off-by: Rusty Russell --- lib/tdb/common/transaction.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/tdb/common/transaction.c') diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 66ecbfdefb..f7d56a05a3 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -730,7 +730,11 @@ static int tdb_recovery_allocate(struct tdb_context *tdb, *recovery_size = tdb_recovery_size(tdb); /* round up to a multiple of page size */ - *recovery_max_size = TDB_ALIGN(sizeof(rec) + *recovery_size, tdb->page_size) - sizeof(rec); + *recovery_max_size = tdb_expand_adjust(tdb->map_size, + *recovery_size, + tdb->page_size) + - sizeof(rec); + *recovery_offset = tdb->map_size; recovery_head = *recovery_offset; -- cgit