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/syncop.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/syncop.h') diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 1bea189a7..8ec4e9e58 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -56,6 +56,7 @@ struct synctask { struct syncenv *env; xlator_t *xl; call_frame_t *frame; + call_frame_t *opframe; synctask_cbk_t synccbk; synctask_fn_t syncfn; synctask_state_t state; @@ -153,12 +154,14 @@ struct syncargs { #define SYNCOP(subvol, stb, cbk, op, params ...) do { \ - call_frame_t *frame = NULL; \ + struct synctask *task = NULL; \ \ - frame = syncop_create_frame (); \ + task = synctask_get (); \ \ - STACK_WIND_COOKIE (frame, cbk, (void *)stb, subvol, op, params); \ + STACK_WIND_COOKIE (task->opframe, cbk, (void *)stb, \ + subvol, op, params); \ __yield (stb); \ + STACK_RESET (task->opframe->root); \ } while (0) -- cgit