diff --git a/src/blockstore_open.cpp b/src/blockstore_open.cpp index 7c57dbde..1bfbd064 100644 --- a/src/blockstore_open.cpp +++ b/src/blockstore_open.cpp @@ -19,7 +19,7 @@ void blockstore_impl_t::parse_config(blockstore_config_t & config, bool init) throttle_target_mbs = strtoull(config["throttle_target_mbs"].c_str(), NULL, 10); throttle_target_parallelism = strtoull(config["throttle_target_parallelism"].c_str(), NULL, 10); throttle_threshold_us = strtoull(config["throttle_threshold_us"].c_str(), NULL, 10); - if (config.find("autosync_writes") != config.end()) + if (config["autosync_writes"] != "") { autosync_writes = strtoull(config["autosync_writes"].c_str(), NULL, 10); } diff --git a/src/osd.cpp b/src/osd.cpp index b85e7210..23a006e5 100644 --- a/src/osd.cpp +++ b/src/osd.cpp @@ -22,7 +22,7 @@ static blockstore_config_t json_to_bs(const json11::Json::object & config) { if (kv.second.is_string()) bs[kv.first] = kv.second.string_value(); - else + else if (!kv.second.is_null()) bs[kv.first] = kv.second.dump(); } return bs; @@ -194,7 +194,8 @@ void osd_t::parse_config(bool init) if (autosync_interval > MAX_AUTOSYNC_INTERVAL) autosync_interval = DEFAULT_AUTOSYNC_INTERVAL; } - if (!config["autosync_writes"].is_null()) + if (config["autosync_writes"].is_number() || + config["autosync_writes"].string_value() != "") { // Allow to set it to 0 autosync_writes = config["autosync_writes"].uint64_value();