From: Sage Weil Date: Mon, 11 Jan 2016 18:42:00 +0000 (-0500) Subject: os/bluestore: base initial bluefs allocation on min_alloc_ratio X-Git-Tag: v10.0.3~43^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d50ddbaa047cde0a53d414e878fbf4337c1fee1a;p=ceph.git os/bluestore: base initial bluefs allocation on min_alloc_ratio Simplify config, and avoid immediate gift or reclaim when it doesn't match. Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index f7ac5a60dc2c..7b554c94c988 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -849,7 +849,6 @@ OPTION(bluefs_min_flush_size, OPT_U64, 65536) // ignore flush until its this bi OPTION(bluestore_bluefs, OPT_BOOL, true) OPTION(bluestore_bluefs_env_mirror, OPT_BOOL, false) // mirror to normal Env for debug -OPTION(bluestore_bluefs_initial_length, OPT_U64, 65536*1024) OPTION(bluestore_bluefs_min_ratio, OPT_FLOAT, .01) OPTION(bluestore_bluefs_min_free_ratio, OPT_FLOAT, .1) OPTION(bluestore_bluefs_max_free_fs_main_ratio, OPT_FLOAT, .8) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ef706d434182..7574ddb6ebec 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1181,8 +1181,11 @@ int BlueStore::_open_db(bool create) if (create) { // note: we might waste a 4k block here if block.db is used, but it's // simpler. - bluefs->add_block_extent(id, BLUEFS_START, - g_conf->bluestore_bluefs_initial_length); + uint64_t initial = + bdev->get_size() * g_conf->bluestore_bluefs_min_ratio; + initial = ROUND_UP_TO(initial, g_conf->bluefs_alloc_size); + bluefs->add_block_extent(id, BLUEFS_START, initial); + bluefs_extents.insert(BLUEFS_START, initial); } bluefs_shared_bdev = id; ++id; @@ -1593,11 +1596,10 @@ int BlueStore::mkfs() KeyValueDB::Transaction t = db->get_transaction(); uint64_t reserved = 0; if (g_conf->bluestore_bluefs) { - reserved = BLUEFS_START + g_conf->bluestore_bluefs_initial_length; - dout(20) << __func__ << " reserved first " << reserved - << " bytes for bluefs" << dendl; - bluefs_extents.insert(BLUEFS_START, - g_conf->bluestore_bluefs_initial_length); + assert(bluefs_extents.num_intervals() == 1); + interval_set::iterator p = bluefs_extents.begin(); + reserved = p.get_start() + p.get_len(); + dout(20) << __func__ << " reserved " << reserved << " for bluefs" << dendl; bufferlist bl; ::encode(bluefs_extents, bl); t->set(PREFIX_SUPER, "bluefs_extents", bl);