summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-heal.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-06-30 23:01:36 +0530
committerXavier Hernandez <xhernandez@datalab.es>2015-07-06 03:31:27 -0700
commitc6742adc98a9747f5e16c242aaddc28ea991ec5a (patch)
tree5992ccf21d5fa5a35b2935e2f169d202aafb54f9 /xlators/cluster/ec/src/ec-heal.c
parent214101394bdea4ab57b8704467f450df4adbb8f6 (diff)
cluster/ec: Make background healing optional behavior
Provide options to control number of active background heal count and qlen. Change-Id: Idc2419219d881f47e7d2e9bbc1dcdd999b372033 BUG: 1237381 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/11473 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-heal.c')
-rw-r--r--xlators/cluster/ec/src/ec-heal.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index 31685356db0..6ee1f9ee832 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -26,9 +26,6 @@
#include "syncop-utils.h"
#include "cluster-syncop.h"
-#define EC_MAX_BACKGROUND_HEALS 8
-#define EC_MAX_HEAL_WAITERS 128
-
#define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr; })
#define EC_COUNT(array, max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res; })
#define EC_INTERSECT(dst, src1, src2, max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i]; })
@@ -2329,10 +2326,9 @@ __ec_dequeue_heals (ec_t *ec)
if (list_empty (&ec->heal_waiting))
goto none;
- if (ec->healers == EC_MAX_BACKGROUND_HEALS)
+ if ((ec->background_heals > 0) && (ec->healers >= ec->background_heals))
goto none;
- GF_ASSERT (ec->healers < EC_MAX_BACKGROUND_HEALS);
fop = list_entry(ec->heal_waiting.next, ec_fop_data_t, healer);
ec->heal_waiters--;
list_del_init(&fop->healer);
@@ -2400,12 +2396,14 @@ ec_heal_throttle (xlator_t *this, ec_fop_data_t *fop)
LOCK (&ec->lock);
{
- if (ec->heal_waiters >= EC_MAX_HEAL_WAITERS) {
- can_heal = _gf_false;
- } else {
+ if ((ec->background_heals > 0) &&
+ (ec->heal_wait_qlen + ec->background_heals) >
+ (ec->heal_waiters + ec->healers)) {
list_add_tail(&fop->healer, &ec->heal_waiting);
ec->heal_waiters++;
fop = __ec_dequeue_heals (ec);
+ } else {
+ can_heal = _gf_false;
}
}
UNLOCK (&ec->lock);