diff options
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 9 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 829914f8bea..de92affc6d3 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -645,7 +645,7 @@ afr_accuse_smallfiles (xlator_t *this, struct afr_reply *replies, for (i = 0; i < priv->child_count; i++) { if (data_accused[i]) continue; - if ((priv->arbiter_count == 1) && (i == ARBITER_BRICK_INDEX)) + if (AFR_IS_ARBITER_BRICK(priv, i)) continue; if (replies[i].poststat.ia_size < maxsize) data_accused[i] = 1; @@ -1732,8 +1732,7 @@ afr_local_discovery_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ if (is_local) { /* Don't set arbiter as read child. */ - if ((priv->arbiter_count == 1) && - (child_index == ARBITER_BRICK_INDEX)) + if (AFR_IS_ARBITER_BRICK(priv, child_index)) goto out; gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCAL_CHILD, "selecting local read_child %s", @@ -3616,6 +3615,8 @@ afr_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) if (!local) goto out; + if (priv->arbiter_count == 1 && local->child_up[ARBITER_BRICK_INDEX]) + local->call_count--; call_count = local->call_count; if (!call_count) { op_errno = ENOTCONN; @@ -3624,6 +3625,8 @@ afr_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) for (i = 0; i < priv->child_count; i++) { if (local->child_up[i]) { + if (AFR_IS_ARBITER_BRICK(priv, i)) + continue; STACK_WIND (frame, afr_statfs_cbk, priv->children[i], priv->children[i]->fops->statfs, diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 37e268b1586..32fcd1a2f2b 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -680,7 +680,7 @@ __afr_selfheal_data (call_frame_t *frame, xlator_t *this, fd_t *fd, source = ret; - if (priv->arbiter_count == 1 && source == ARBITER_BRICK_INDEX && + if (AFR_IS_ARBITER_BRICK(priv, source) && AFR_COUNT (sources, priv->child_count) == 1) { did_sh = _gf_false; goto unlock; diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index c8e1a5f0008..7f995c731d7 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -49,7 +49,7 @@ typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this); #define AFR_COUNT(array,max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res;}) #define AFR_INTERSECT(dst,src1,src2,max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i];}) #define AFR_CMP(a1,a2,len) ({int __cmp = 0; int __i; for (__i = 0; __i < len; __i++) if (a1[__i] != a2[__i]) { __cmp = 1; break;} __cmp;}) - +#define AFR_IS_ARBITER_BRICK(priv, index) ((priv->arbiter_count == 1) && (index == ARBITER_BRICK_INDEX)) typedef struct _afr_private { gf_lock_t lock; /* to guard access to child_count, etc */ unsigned int child_count; /* total number of children */ |