diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-04-23 10:49:02 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-04-23 13:11:49 -0700 |
commit | eb9003cdca755980da9ed5a3a3fb0fc52c750131 (patch) | |
tree | 7ed1f88457bfa0ed2cfdf2cb1ede2a50cc966b59 /libglusterfs/src/syncop.h | |
parent | fc024df2b6f9307f23a4a0800103555708036b17 (diff) |
libglusterfs: Never block syncproc
Change-Id: I64cd8a2ef37926173c19a33df0716183530e22bf
BUG: 814074
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3194
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/syncop.h')
-rw-r--r-- | libglusterfs/src/syncop.h | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index f095319c4d9..12a00d58acc 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -64,7 +64,6 @@ struct synctask { void *stack; int woken; int slept; - int complete; int ret; ucontext_t ctx; @@ -120,54 +119,22 @@ struct syncargs { dict_t *dict; /* do not touch */ - pthread_mutex_t mutex; - char complete; - pthread_cond_t cond; struct synctask *task; }; - -#define __yield(args) do { \ - if (args->task) { \ - synctask_yield (args->task); \ - } else { \ - pthread_mutex_lock (&args->mutex); \ - { \ - while (!args->complete) \ - pthread_cond_wait (&args->cond, \ - &args->mutex); \ - } \ - pthread_mutex_unlock (&args->mutex); \ - \ - pthread_mutex_destroy (&args->mutex); \ - pthread_cond_destroy (&args->cond); \ - } \ - } while (0) - - -#define __wake(args) do { \ - if (args->task) { \ - synctask_wake (args->task); \ - } else { \ - pthread_mutex_lock (&args->mutex); \ - { \ - args->complete = 1; \ - pthread_cond_broadcast (&args->cond); \ - } \ - pthread_mutex_unlock (&args->mutex); \ - } \ - } while (0) +#define __wake(args) synctask_wake(args->task) #define SYNCOP(subvol, stb, cbk, op, params ...) do { \ struct synctask *task = NULL; \ \ task = synctask_get (); \ + stb->task = task; \ \ STACK_WIND_COOKIE (task->opframe, cbk, (void *)stb, \ subvol, op, params); \ - __yield (stb); \ - STACK_RESET (task->opframe->root); \ + synctask_yield (stb->task); \ + STACK_RESET (task->opframe->root); \ } while (0) @@ -178,7 +145,6 @@ void syncenv_destroy (struct syncenv *); void syncenv_scale (struct syncenv *env); int synctask_new (struct syncenv *, synctask_fn_t, synctask_cbk_t, call_frame_t* frame, void *); -void synctask_zzzz (struct synctask *task); void synctask_wake (struct synctask *task); void synctask_yield (struct synctask *task); |