X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftransaction.c;h=dd94510c027343d1c6aac0e6ec0d6e3d28ffeaab;hp=70e664fc2d60e5fe36bda442607fbdfba04677ff;hb=c438ec17d7b2efe76e56e5fc5ab88bd4a02735e8;hpb=695e2ae319052ceb410ef00d0181aa607f1ceb6d;ds=sidebyside diff --git a/ccan/tdb2/transaction.c b/ccan/tdb2/transaction.c index 70e664fc..dd94510c 100644 --- a/ccan/tdb2/transaction.c +++ b/ccan/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.