]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not do gift beyond the max ratio
authorSage Weil <sage@redhat.com>
Sat, 26 Mar 2016 14:30:34 +0000 (10:30 -0400)
committerSage Weil <sage@redhat.com>
Wed, 30 Mar 2016 15:23:15 +0000 (11:23 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 1f516490c7964fd0775e4c7a14486ab94f1793ee..46965fded754fd2284b3c36a79d1664a943dfb2e 100644 (file)
@@ -1483,6 +1483,14 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_extent_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