summaryrefslogtreecommitdiffstats
path: root/lib/tdb2/transaction.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-01-30 09:24:50 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-01-30 09:24:50 +1030
commitefbf52b4fe62eeed085961d7e2689b869bae63dc (patch)
tree2b9c45dca6168947ca3c25443268a71043b43b12 /lib/tdb2/transaction.c
parent205e198471a481b849d05b5756261f1739c0c8b2 (diff)
downloadsamba-efbf52b4fe62eeed085961d7e2689b869bae63dc.tar.gz
samba-efbf52b4fe62eeed085961d7e2689b869bae63dc.tar.xz
samba-efbf52b4fe62eeed085961d7e2689b869bae63dc.zip
tdb2: copy tdb1's changed expansion logic.
TDB2 uses the same expansion logic as TDB1, which got factored out recently. So update TDB2 to match. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c438ec17d7b2efe76e56e5fc5ab88bd4a02735e8)
Diffstat (limited to 'lib/tdb2/transaction.c')
-rw-r--r--lib/tdb2/transaction.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/tdb2/transaction.c b/lib/tdb2/transaction.c
index 70e664fc2d6..dd94510c027 100644
--- a/lib/tdb2/transaction.c
+++ b/lib/tdb2/transaction.c
@@ -836,10 +836,13 @@ static tdb_off_t create_recovery_area(struct tdb_context *tdb,
/* round up to a multiple of page size. Overallocate, since each
* such allocation forces us to expand the file. */
- rec->max_len
- = (((sizeof(*rec) + rec_length + rec_length / 2)
- + PAGESIZE-1) & ~(PAGESIZE-1))
+ rec->max_len = tdb_expand_adjust(tdb->file->map_size, rec_length);
+
+ /* Round up to a page. */
+ rec->max_len = ((sizeof(*rec) + rec->max_len + PAGESIZE-1)
+ & ~(PAGESIZE-1))
- sizeof(*rec);
+
off = tdb->file->map_size;
/* Restore ->map_size before calling underlying expand_file.