From: xie xingguo Date: Thu, 1 Sep 2016 10:42:58 +0000 (+0800) Subject: os/bluestore: don't over-gift if bluefs free is smaller than bluestore_bluefs_min X-Git-Tag: v11.0.1~341^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8bab52275aebff5bb22829245456e0d390b07b10;p=ceph.git os/bluestore: don't over-gift if bluefs free is smaller than bluestore_bluefs_min - 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e24dda5f7f01..3d8aa8df126b 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2393,8 +2393,10 @@ int BlueStore::_balance_bluefs_freespace(vector *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 *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