]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add bluestore_bluefs_max_free option
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 7 Sep 2019 01:24:37 +0000 (09:24 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 9 Sep 2019 00:06:36 +0000 (08:06 +0800)
This prevents bluefs from trying to acquire more space than
it actually needs, e.g., due to batch deletion of user data.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/common/options.cc
src/os/bluestore/BlueStore.cc

index f28d94f837c1385c7ed3f88f47dedd50cd01a982..7f1297b7d90bd266819ff8dfbca2f263fcf12b39 100644 (file)
@@ -4359,6 +4359,10 @@ std::vector<Option> get_global_options() {
     .set_default(1_G)
     .set_description("minimum free space allocated to BlueFS"),
 
+    Option("bluestore_bluefs_max_free", Option::TYPE_SIZE, Option::LEVEL_ADVANCED)
+    .set_default(10_G)
+    .set_description("Maximum free space allocated to BlueFS"),
+
     Option("bluestore_bluefs_min_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(.02)
     .set_description("Minimum fraction of free space devoted to BlueFS"),
index 40f29fcf7815a2f118b7bc2a3c33f18da2364960..d4358b47a4844889924a03d2ea083eae487a5c63 100644 (file)
@@ -5807,7 +5807,8 @@ int64_t BlueStore::_get_bluefs_size_delta(uint64_t bluefs_free, uint64_t bluefs_
       gift = g;
     reclaim = 0;
   }
-  uint64_t min_free = cct->_conf.get_val<Option::size_t>("bluestore_bluefs_min_free");
+  uint64_t min_free =
+    cct->_conf.get_val<Option::size_t>("bluestore_bluefs_min_free");
   if (bluefs_free < min_free &&
       min_free < free_cap) {
     uint64_t g = min_free - bluefs_free;
@@ -5818,6 +5819,14 @@ int64_t BlueStore::_get_bluefs_size_delta(uint64_t bluefs_free, uint64_t bluefs_
       gift = g;
     reclaim = 0;
   }
+  uint64_t max_free =
+    cct->_conf.get_val<Option::size_t>("bluestore_bluefs_max_free");
+  if (bluefs_free > max_free) {
+    dout(10) << __func__ << " bluefs_free " << bluefs_free
+             << " > max " << max_free
+             << ", stop gifting for now" << dendl;
+    gift = 0;
+  }
   ceph_assert((int64_t)gift >= 0);
   ceph_assert((int64_t)reclaim >= 0);
   return gift > 0 ? (int64_t)gift : -(int64_t)reclaim;