Make cache size run-time configurable.
[bluesky.git] / bluesky / log.c
index c8641b7..1fe6176 100644 (file)
 // no absolute guarantees on the size of a log segment.
 #define LOG_SEGMENT_SIZE (1 << 22)
 
-// Target amount of disk space to use for the journal and cache files, in
-// kilobytes.
-#define DISK_CACHE_SIZE_TARGET (64 * 1024)
-
 #define HEADER_MAGIC 0x676f4c0a
 #define FOOTER_MAGIC 0x2e435243
 
@@ -521,7 +517,8 @@ void bluesky_cachefile_gc(BlueSkyFS *fs)
             g_print("\n");
 
             gboolean deletion_candidate = FALSE;
-            if (g_atomic_int_get(&fs->log->disk_used) > DISK_CACHE_SIZE_TARGET
+            if (g_atomic_int_get(&fs->log->disk_used)
+                    > bluesky_options.cache_size
                 && g_atomic_int_get(&cachefile->refcount) == 0
                 && g_atomic_int_get(&cachefile->mapcount) == 0)
             {