From f5cee451d1d2df3e8deb2034b445c1196b2bfa77 Mon Sep 17 00:00:00 2001 From: Nicolas Tsiftes Date: Fri, 4 May 2018 18:12:10 +0200 Subject: [PATCH] Use a default Coffee file reservation size in Antelope that is selected in relation to the file system size. --- os/storage/antelope/db-options.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/os/storage/antelope/db-options.h b/os/storage/antelope/db-options.h index f82c72edc..2be415f4e 100644 --- a/os/storage/antelope/db-options.h +++ b/os/storage/antelope/db-options.h @@ -38,6 +38,7 @@ #define DB_OPTIONS_H #include "contiki.h" +#include "cfs-coffee-arch.h" /*----------------------------------------------------------------------------*/ @@ -143,9 +144,17 @@ /* The default relation file size to reserve when using Coffee. */ #ifndef DB_COFFEE_RESERVE_SIZE -#define DB_COFFEE_RESERVE_SIZE (128 * 1024UL) +#define DB_COFFEE_RESERVE_SIZE (COFFEE_SIZE / 8) #endif /* DB_COFFEE_RESERVE_SIZE */ +/* + * Ensure that the default size of Coffee file reservations is suitable + * for the file system size. + */ +#if DB_COFFEE_RESERVE_SIZE > (COFFEE_SIZE / 2) +#error DB_COFFEE_RESERVE_SIZE is too large for the file system. +#endif + /* The maximum size of the physical storage of a tuple (labelled a "row" in Antelope's terminology. */ #ifndef DB_MAX_CHAR_SIZE_PER_ROW