diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-03-08 22:17:46 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-09 22:19:32 -0800 |
commit | 5b290bc6e3df76bea04c11cb15643173c33455bd (patch) | |
tree | cb20cb1d057093d26b9c2b7577deffab4953b39b /libglusterfs/src/stack.h | |
parent | bc10ade1cff9d6cd3b3528ec6c845efadc722481 (diff) |
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 <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2850
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs/src/stack.h')
-rw-r--r-- | libglusterfs/src/stack.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 220eab49d0e..a18ca6deb89 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 |