]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: base initial bluefs allocation on min_alloc_ratio
authorSage Weil <sage@redhat.com>
Mon, 11 Jan 2016 18:42:00 +0000 (13:42 -0500)
committerSage Weil <sage@redhat.com>
Mon, 11 Jan 2016 19:42:47 +0000 (14:42 -0500)
Simplify config, and avoid immediate gift or reclaim when it doesn't match.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc

index f7ac5a60dc2c0564f03f793e04e92e79be66f90d..7b554c94c988d6398c527e52bd3eda771606748e 100644 (file)
@@ -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)
index ef706d434182108381d79e752b358f241c53724e..7574ddb6ebec370060a0f01cc435552f2fe0e93e 100644 (file)
@@ -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<uint64_t>::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);