diff --git a/cluster_client.h b/cluster_client.h index fb36fefd..dbdc769c 100644 --- a/cluster_client.h +++ b/cluster_client.h @@ -8,7 +8,6 @@ #define MIN_BLOCK_SIZE 4*1024 #define MAX_BLOCK_SIZE 128*1024*1024 -#define DEFAULT_BLOCK_SIZE 128*1024 #define DEFAULT_DISK_ALIGNMENT 4096 #define DEFAULT_BITMAP_GRANULARITY 4096 #define DEFAULT_CLIENT_DIRTY_LIMIT 32*1024*1024 diff --git a/etcd_state_client.cpp b/etcd_state_client.cpp index a986ab93..0c13a5e0 100644 --- a/etcd_state_client.cpp +++ b/etcd_state_client.cpp @@ -229,6 +229,11 @@ void etcd_state_client_t::load_global_config() global_config = kv.value.object_items(); } } + bs_block_size = global_config["block_size"].uint64_value(); + if (!bs_block_size) + { + bs_block_size = DEFAULT_BLOCK_SIZE; + } on_load_config_hook(global_config); }); } @@ -359,9 +364,11 @@ void etcd_state_client_t::parse_state(const std::string & key, const json11::Jso parsed_cfg.pg_count = pool_item.second["pg_count"].uint64_value(); parsed_cfg.failure_domain = pool_item.second["failure_domain"].string_value(); parsed_cfg.pg_stripe_size = pool_item.second["pg_stripe_size"].uint64_value(); - if (!parsed_cfg.pg_stripe_size) + uint64_t min_stripe_size = bs_block_size * + (parsed_cfg.scheme == POOL_SCHEME_REPLICATED ? 1 : parsed_cfg.pg_minsize); + if (parsed_cfg.pg_stripe_size < min_stripe_size) { - parsed_cfg.pg_stripe_size = DEFAULT_PG_STRIPE_SIZE; + parsed_cfg.pg_stripe_size = min_stripe_size; } parsed_cfg.max_osd_combinations = pool_item.second["max_osd_combinations"].uint64_value(); if (!parsed_cfg.max_osd_combinations) diff --git a/etcd_state_client.h b/etcd_state_client.h index 2f6a92f9..9db47eed 100644 --- a/etcd_state_client.h +++ b/etcd_state_client.h @@ -16,7 +16,7 @@ #define ETCD_SLOW_TIMEOUT 5000 #define ETCD_QUICK_TIMEOUT 1000 -#define DEFAULT_PG_STRIPE_SIZE 4*1024*1024 +#define DEFAULT_BLOCK_SIZE 128*1024 struct json_kv_t { @@ -62,6 +62,7 @@ struct etcd_state_client_t int etcd_watches_initialised = 0; uint64_t etcd_watch_revision = 0; websocket_t *etcd_watch_ws = NULL; + uint64_t bs_block_size = 0; std::map pool_config; std::map peer_states;