summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.h
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-02-13 06:24:18 +0530
committerAmar Tumballi <amarts@redhat.com>2018-03-09 18:32:56 +0000
commit940f870f4716f9cd32c68db95aa326a0ae87bf03 (patch)
tree36ccd616706422a69b771b0402e55f56dbd84093 /libglusterfs/src/stack.h
parentb2613c9eed6b9d840bc88105dadf282488e6cd64 (diff)
core: provide infra to make any xlator pass-through
updates: #304 Change-Id: If6a13d2e56b195390a386d720103a882e077f66c Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src/stack.h')
-rw-r--r--libglusterfs/src/stack.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index e7d0b3ff7f4..87fbef9e3c9 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -258,6 +258,7 @@ STACK_RESET (call_stack_t *stack)
xlator_t *old_THIS = NULL; \
xlator_t *next_xl = obj; \
typeof(fn) next_xl_fn = fn; \
+ int opn = get_fop_index_from_fn((next_xl), (fn)); \
\
frame->this = next_xl; \
frame->wind_to = #fn; \
@@ -269,13 +270,15 @@ STACK_RESET (call_stack_t *stack)
frame->root, old_THIS->name, \
THIS->name); \
/* Need to capture counts at leaf node */ \
- if (!next_xl->children) { \
- int op = get_fop_index_from_fn((next_xl), (fn)); \
- GF_ATOMIC_INC (next_xl->stats.total.metrics[op].fop); \
- GF_ATOMIC_INC (next_xl->stats.interval.metrics[op].fop); \
+ if (!next_xl->pass_through && !next_xl->children) { \
+ GF_ATOMIC_INC (next_xl->stats.total.metrics[opn].fop); \
+ GF_ATOMIC_INC (next_xl->stats.interval.metrics[opn].fop); \
GF_ATOMIC_INC (next_xl->stats.total.count); \
GF_ATOMIC_INC (next_xl->stats.interval.count); \
} \
+ if (next_xl->pass_through) { \
+ next_xl_fn = (void *)*((&next_xl->pass_through_fops->stat) + (opn - 1)); \
+ } \
next_xl_fn (frame, next_xl, params); \
THIS = old_THIS; \
} while (0)
@@ -298,6 +301,7 @@ STACK_RESET (call_stack_t *stack)
do { \
call_frame_t *_new = NULL; \
xlator_t *old_THIS = NULL; \
+ typeof(fn) next_xl_fn = fn; \
\
_new = mem_get0 (frame->root->pool->frame_mem_pool); \
if (!_new) { \
@@ -332,11 +336,15 @@ STACK_RESET (call_stack_t *stack)
if (obj->ctx->measure_latency) \
timespec_now (&_new->begin); \
_new->op = get_fop_index_from_fn ((_new->this), (fn)); \
- GF_ATOMIC_INC (obj->stats.total.metrics[_new->op].fop); \
- GF_ATOMIC_INC (obj->stats.interval.metrics[_new->op].fop); \
- GF_ATOMIC_INC (obj->stats.total.count); \
- GF_ATOMIC_INC (obj->stats.interval.count); \
- fn (_new, obj, params); \
+ if (!obj->pass_through) { \
+ GF_ATOMIC_INC (obj->stats.total.metrics[_new->op].fop); \
+ GF_ATOMIC_INC (obj->stats.interval.metrics[_new->op].fop); \
+ GF_ATOMIC_INC (obj->stats.total.count); \
+ GF_ATOMIC_INC (obj->stats.interval.count); \
+ } else { \
+ next_xl_fn = (void *)*((&obj->pass_through_fops->stat) + (_new->op - 1)); \
+ } \
+ next_xl_fn (_new, obj, params); \
THIS = old_THIS; \
} while (0)