From 5b290bc6e3df76bea04c11cb15643173c33455bd Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 8 Mar 2012 22:17:46 +0530 Subject: syncop: Make syntask scalable At the moment, synctask uses task->frame to perform all the syncops, this will lead to high-memory usage if the task crawls millions of directories. i.e millions of STACK_WINDS/UNWINDS. To prevent this, in each task a new stack is created to perform the fops which is reset after every syncop. Change-Id: I53c262ec348be9b1d91af73da01f1c217f31ce6e BUG: 798907 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2850 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- libglusterfs/src/stack.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libglusterfs/src/stack.h') diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 220eab49..a18ca6de 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -177,6 +177,7 @@ STACK_DESTROY (call_stack_t *stack) } LOCK_DESTROY (&stack->frames.lock); + LOCK_DESTROY (&stack->stack_lock); while (stack->frames.next) { FRAME_DESTROY (stack->frames.next); @@ -187,6 +188,23 @@ STACK_DESTROY (call_stack_t *stack) mem_put (local); } +static inline void +STACK_RESET (call_stack_t *stack) +{ + void *local = NULL; + + if (stack->frames.local) { + local = stack->frames.local; + stack->frames.local = NULL; + } + + while (stack->frames.next) { + FRAME_DESTROY (stack->frames.next); + } + + if (local) + mem_put (local); +} #define cbk(x) cbk_##x -- cgit