/* Should frontends handle requests serially or allow operations to proceed
* in parallel? */
int sync_frontends;
+
+ /* Target size of the disk cache at the proxy, in kilobytes. */
+ int cache_size;
} BlueSkyOptions;
extern BlueSkyOptions bluesky_options;
int bluesky_verbose = 0;
-BlueSkyOptions bluesky_options;
+BlueSkyOptions bluesky_options = {
+ .cache_size = 1024*1024, // Default cache size is 1 GiB
+};
/* Maximum number of threads to use in any particular thread pool, or -1 for no
* limit */
{"BLUESKY_OPT_WRITETHROUGH", &bluesky_options.writethrough_cache},
{"BLUESKY_OPT_SYNC_INODE_FETCH", &bluesky_options.sync_inode_fetches},
{"BLUESKY_OPT_SYNC_FRONTENDS", &bluesky_options.sync_frontends},
+ {"BLUESKY_CACHE_SIZE", &bluesky_options.cache_size},
{NULL, NULL}
};
// 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
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)
{