From 30653175901204b40b051e510253f09d76b3555b Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Fri, 23 Oct 2015 12:27:32 +0530 Subject: tier/ctr: Correcting the internal fop calculation Correcting the internal fop calculation method, as it had wrong logic. Change-Id: I1d0b40a1e27548147203ddd503794059652ac049 Signed-off-by: Joseph Fernandes Reviewed-on: http://review.gluster.org/12418 Tested-by: Gluster Build System Reviewed-by: Dan Lambright Tested-by: Dan Lambright --- .../features/changetimerecorder/src/ctr-helper.h | 39 ++++++++++++++-------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'xlators/features/changetimerecorder/src/ctr-helper.h') diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index 4f650350c94..444b2c8f161 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -282,23 +282,34 @@ do {\ * Internal fop * * */ -#define CTR_IS_INTERNAL_FOP(frame, dict)\ - (AFR_SELF_HEAL_FOP (frame) \ - || (REBALANCE_FOP (frame) && dict && \ - !dict_get (dict, CTR_ATTACH_TIER_LOOKUP)) \ - || (TIER_REBALANCE_FOP (frame) && dict && \ - !dict_get (dict, CTR_ATTACH_TIER_LOOKUP)) \ - || (dict && \ - dict_get (dict, GLUSTERFS_INTERNAL_FOP_KEY))) +static inline +gf_boolean_t is_internal_fop (call_frame_t *frame, + dict_t *xdata) +{ + gf_boolean_t ret = _gf_false; + + GF_ASSERT(frame); + GF_ASSERT(frame->root); + + if (AFR_SELF_HEAL_FOP (frame)) { + ret = _gf_true; + } + if (REBALANCE_FOP (frame) || TIER_REBALANCE_FOP (frame)) { + ret = _gf_true; + if (xdata && dict_get (xdata, CTR_ATTACH_TIER_LOOKUP)) { + ret = _gf_false; + } + } + if (xdata && dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { + ret = _gf_true; + } + + return ret; +} -/** - * ignore internal fops for all clients except AFR self-heal daemon - */ #define CTR_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label)\ do {\ - GF_ASSERT(frame);\ - GF_ASSERT(frame->root);\ - if (CTR_IS_INTERNAL_FOP(frame, dict)) \ + if (is_internal_fop (frame, dict)) \ goto label; \ } while (0) -- cgit