1 /* Blue Sky: File Systems in the Cloud
3 * Copyright (C) 2009 The Regents of the University of California
4 * Written by Michael Vrable <mvrable@cs.ucsd.edu>
14 #include "bluesky-private.h"
16 int bluesky_verbose = 0;
18 BlueSkyOptions bluesky_options = {
19 .cache_size = 1024*1024, // Default cache size is 1 GiB
22 /* Maximum number of threads to use in any particular thread pool, or -1 for no
24 int bluesky_max_threads = 16;
26 /* Watermark levels for cache tuning: these control when dirty data is flushed
27 * from cache, when clean data is dropped from the cache, etc. These values
28 * are measured in blocks, not bytes.
30 * There are a few relevant levels:
31 * low: Below this point, data is not forced out due to memory pressure
32 * medium: At this point start flushing data to get back below medium
33 * high: Flush data very aggressively (launch extra tasks if needed)
35 int bluesky_watermark_low_dirty = (64 << 20) / BLUESKY_BLOCK_SIZE;
36 int bluesky_watermark_medium_dirty = (96 << 20) / BLUESKY_BLOCK_SIZE;
37 int bluesky_watermark_high_dirty = (192 << 20) / BLUESKY_BLOCK_SIZE;
39 int bluesky_watermark_low_total = (64 << 20) / BLUESKY_BLOCK_SIZE;
40 int bluesky_watermark_medium_total = (128 << 20) / BLUESKY_BLOCK_SIZE;
41 int bluesky_watermark_high_total = (256 << 20) / BLUESKY_BLOCK_SIZE;
43 /* Environment variables that can be used to initialize settings. */
48 {"BLUESKY_VERBOSE", &bluesky_verbose},
49 {"BLUESKY_OPT_SYNC_STORES", &bluesky_options.synchronous_stores},
50 {"BLUESKY_OPT_WRITETHROUGH", &bluesky_options.writethrough_cache},
51 {"BLUESKY_OPT_SYNC_INODE_FETCH", &bluesky_options.sync_inode_fetches},
52 {"BLUESKY_OPT_SYNC_FRONTENDS", &bluesky_options.sync_frontends},
53 {"BLUESKY_CACHE_SIZE", &bluesky_options.cache_size},
54 {"BLUESKY_OPT_FULL_SEGMENTS", &bluesky_options.full_segment_fetches},
55 {"BLUESKY_OPT_NO_AGGREGATION", &bluesky_options.disable_aggregation},
56 {"BLUESKY_OPT_NO_CRYPTO", &bluesky_options.disable_crypto},
60 /* BlueSky library initialization. */
62 void bluesky_store_init_s3(void);
63 void bluesky_store_init_azure(void);
64 void bluesky_store_init_kv(void);
65 void bluesky_store_init_multi(void);
66 void bluesky_store_init_bdb(void);
67 void bluesky_store_init_simple(void);
69 /* Initialize the BlueSky library and dependent libraries. */
70 void bluesky_init(void)
75 for (int i = 0; option_table[i].env != NULL; i++) {
76 const char *val = getenv(option_table[i].env);
79 g_print("Option %s set to %d\n", option_table[i].env, v);
80 *option_table[i].option = atoi(val);
85 bluesky_store_init_kv();
86 bluesky_store_init_s3();
87 bluesky_store_init_azure();
88 bluesky_store_init_multi();
89 bluesky_store_init_bdb();
90 bluesky_store_init_simple();