From: Michael Vrable Date: Thu, 28 Jan 2010 18:56:11 +0000 (-0800) Subject: Let storage tuning options be set via environment variables. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=8ff2f84811f4d4b7c684e04b4cc8d1aced2a1d4a;p=bluesky.git Let storage tuning options be set via environment variables. This should make benchmarking runs easier. --- diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 58ff29f..421d07d 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -28,7 +28,7 @@ typedef struct { /* Can inodes be fetched asynchronously? (Inode object is initially * created in a pending state, and not unlocked until the data is actually * available.) */ - int async_inode_fetches; + int sync_inode_fetches; } BlueSkyOptions; extern BlueSkyOptions bluesky_options; diff --git a/bluesky/init.c b/bluesky/init.c index 69fbe62..7a6efe1 100644 --- a/bluesky/init.c +++ b/bluesky/init.c @@ -15,6 +15,17 @@ BlueSkyOptions bluesky_options; +/* Environment variables that can be used to initialize settings. */ +static struct { + const char *env; + int *option; +} option_table[] = { + {"BLUESKY_OPT_SYNC_STORES", &bluesky_options.synchronous_stores}, + {"BLUESKY_OPT_WRITETHROUGH", &bluesky_options.writethrough_cache}, + {"BLUESKY_OPT_SYNC_INODE_FETCH", &bluesky_options.sync_inode_fetches}, + {NULL, NULL} +}; + /* BlueSky library initialization. */ void bluesky_store_init_s3(void); @@ -25,9 +36,14 @@ void bluesky_init(void) g_thread_init(NULL); bluesky_crypt_init(); - bluesky_options.synchronous_stores = 0; - bluesky_options.writethrough_cache = 0; - bluesky_options.async_inode_fetches = 0; + for (int i = 0; option_table[i].env != NULL; i++) { + const char *val = getenv(option_table[i].env); + if (val != NULL) { + int v = atoi(val); + g_print("Option %s set to %d\n", option_table[i].env, v); + *option_table[i].option = atoi(val); + } + } bluesky_store_init(); bluesky_store_init_s3(); diff --git a/nfs3/nfsd.c b/nfs3/nfsd.c index 9b6ba39..d35c36d 100644 --- a/nfs3/nfsd.c +++ b/nfs3/nfsd.c @@ -33,8 +33,6 @@ int main(int argc, char *argv[]) g_set_prgname("nfsd"); register_rpc(); - bluesky_options.async_inode_fetches = 1; - store = bluesky_store_new("s3"); fs = bluesky_init_fs("export", store);