summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-data.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-03-02 22:09:44 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-11 11:14:56 -0800
commit2807e3fc005630213ab7ad251fef13d61c07ac6b (patch)
tree78fb43e7e147516ab300c0ee050efe65a77fa393 /xlators/cluster/afr/src/afr-self-heal-data.c
parent0e048b309b64e574039fc1ebedb971791d43b5e1 (diff)
cluster/afr: Choose local child as source if possible
It is better to choose local brick as source if possible to prevent over the wire read thus saving on bandwidth. Also changed code to not attempt data-heal if 'source' is selected as arbiter. Change-Id: I9a328d0198422280b13a30ab99545370a301dfea BUG: 1314150 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/13585 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Tested-by: Krutika Dhananjay <kdhananj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 27d2849c158..a2dddafe5c0 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -572,7 +572,6 @@ __afr_selfheal_data_finalize_source (call_frame_t *frame, xlator_t *this,
struct afr_reply *replies,
uint64_t *witness)
{
- int i = 0;
afr_private_t *priv = NULL;
int source = -1;
int sources_count = 0;
@@ -609,13 +608,9 @@ __afr_selfheal_data_finalize_source (call_frame_t *frame, xlator_t *this,
out:
afr_mark_active_sinks (this, sources, locked_on, healed_sinks);
+ source = afr_choose_source_by_policy (priv, sources,
+ AFR_DATA_TRANSACTION);
- for (i = 0; i < priv->child_count; i++) {
- if (sources[i]) {
- source = i;
- break;
- }
- }
return source;
}
@@ -729,8 +724,7 @@ __afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd,
source = ret;
- if (AFR_IS_ARBITER_BRICK(priv, source) &&
- AFR_COUNT (sources, priv->child_count) == 1) {
+ if (AFR_IS_ARBITER_BRICK(priv, source)) {
did_sh = _gf_false;
goto unlock;
}