]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: don't over-gift if bluefs free is smaller than bluestore_bluefs_min 10950/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 1 Sep 2016 10:42:58 +0000 (18:42 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 1 Sep 2016 10:42:58 +0000 (18:42 +0800)
- If free space of bluefs is smaller than bluestore_bluefs_min, then raise it
  exactly up to bluestore_bluefs_min.

- Pre-check if bluestore_bluefs_min will exceed bluestore_bluefs_max_ratio * bluefs_total,
  so if free space of bluefs is smaller than bluestore_bluefs_min_ratio * bluefs_total,
  we'll still be able to gift.

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

index e24dda5f7f017edeacac6f265ebb22b2b3897e53..3d8aa8df126b831d2c903fc437aa734a65d1fecd 100644 (file)
@@ -2393,8 +2393,10 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_pextent_t> *extents)
             << " > max_ratio " << g_conf->bluestore_bluefs_max_ratio
             << ", should reclaim " << pretty_si_t(reclaim) << dendl;
   }
-  if (bluefs_total < g_conf->bluestore_bluefs_min) {
-    uint64_t g = g_conf->bluestore_bluefs_min;
+  if (bluefs_total < g_conf->bluestore_bluefs_min &&
+    g_conf->bluestore_bluefs_min <
+      (uint64_t)(g_conf->bluestore_bluefs_max_ratio * total_free)) {
+    uint64_t g = g_conf->bluestore_bluefs_min - bluefs_total;
     dout(10) << __func__ << " bluefs_total " << bluefs_total
             << " < min " << g_conf->bluestore_bluefs_min
             << ", should gift " << pretty_si_t(g) << dendl;
@@ -2402,14 +2404,6 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_pextent_t> *extents)
       gift = g;
     reclaim = 0;
   }
-  if (gift) {
-    float new_bluefs_ratio = (float)(bluefs_free + gift) / (float)total_free;
-    if (new_bluefs_ratio >= g_conf->bluestore_bluefs_max_ratio) {
-      dout(10) << __func__ << " gift would push us past the max_ratio,"
-              << " doing nothing" << dendl;
-      gift = 0;
-    }
-  }
 
   if (gift) {
     // round up to alloc size