From 41d7e780fb92ce7d8ab3df6d39baf17a023807a3 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. backport of http://review.gluster.org/#/c/12418/ Change-Id: I1deeae8b67dd967159853b494e89a3f46572c962 BUG: 1275483 Signed-off-by: Joseph Fernandes Reviewed-on: http://review.gluster.org/12423 Tested-by: Gluster Build System Reviewed-by: Dan Lambright Tested-by: Dan Lambright --- .../changetimerecorder/src/changetimerecorder.c | 6 ++-- .../features/changetimerecorder/src/ctr-helper.h | 39 ++++++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c index 090e54ca319..fb337674937 100644 --- a/xlators/features/changetimerecorder/src/changetimerecorder.c +++ b/xlators/features/changetimerecorder/src/changetimerecorder.c @@ -881,7 +881,7 @@ ctr_unlink (call_frame_t *frame, xlator_t *this, GFDB_FOP_DENTRY_WRITE, GFDB_FOP_WDEL); /*Internal FOP*/ - _inode_cx->is_internal_fop = CTR_IS_INTERNAL_FOP(frame, xdata); + _inode_cx->is_internal_fop = is_internal_fop (frame, xdata); /* If its a internal FOP and dht link file donot record*/ if (_inode_cx->is_internal_fop && @@ -1219,7 +1219,7 @@ ctr_create (call_frame_t *frame, xlator_t *this, GFDB_FOP_CREATE_WRITE, GFDB_FOP_WIND); /*Internal FOP*/ - _inode_cx->is_internal_fop = CTR_IS_INTERNAL_FOP(frame, xdata); + _inode_cx->is_internal_fop = is_internal_fop (frame, xdata); /* If its a internal FOP and dht link file donot record*/ if (_inode_cx->is_internal_fop && @@ -1299,7 +1299,7 @@ ctr_link (call_frame_t *frame, xlator_t *this, GFDB_FOP_DENTRY_WRITE, GFDB_FOP_WIND); /*Internal FOP*/ - _inode_cx->is_internal_fop = CTR_IS_INTERNAL_FOP(frame, xdata); + _inode_cx->is_internal_fop = is_internal_fop (frame, xdata); /* If its a internal FOP and dht link file donot record*/ if (_inode_cx->is_internal_fop && diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index 51dec44598d..e0304140fc4 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -287,23 +287,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