summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/syncop.c2
-rw-r--r--libglusterfs/src/syncop.h42
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.h6
3 files changed, 9 insertions, 41 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index da0444a10..45416c6e7 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -115,7 +115,6 @@ synctask_wake (struct synctask *task)
pthread_cond_broadcast (&env->cond);
}
-
void
synctask_wrap (struct synctask *old_task)
{
@@ -322,7 +321,6 @@ synctask_switchto (struct synctask *task)
pthread_mutex_unlock (&env->mutex);
}
-
void *
syncenv_processor (void *thdata)
{
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index f095319c4..12a00d58a 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);
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h
index 44f983c29..a3cc0ab47 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.h
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h
@@ -28,11 +28,15 @@
/* gd_syncop_* */
#define GD_SYNCOP(rpc, stb, cbk, req, prog, procnum, xdrproc) do { \
int ret = 0; \
+ struct synctask *task = NULL; \
+ task = synctask_get (); \
+ stb->task = task; \
+ \
ret = gd_syncop_submit_request (rpc, req, stb, \
prog, procnum, cbk, \
(xdrproc_t)xdrproc); \
if (!ret) \
- __yield (stb); \
+ synctask_yield (stb->task); \
} while (0)