summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog/src/changelog-rt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/changelog/src/changelog-rt.c')
-rw-r--r--xlators/features/changelog/src/changelog-rt.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/xlators/features/changelog/src/changelog-rt.c b/xlators/features/changelog/src/changelog-rt.c
index c147f68ca..91d47e059 100644
--- a/xlators/features/changelog/src/changelog-rt.c
+++ b/xlators/features/changelog/src/changelog-rt.c
@@ -21,7 +21,8 @@
#include "changelog-mem-types.h"
int
-changelog_rt_init (xlator_t *this, changelog_dispatcher_t *cd)
+changelog_rt_init (xlator_t *this,
+ changelog_dispatcher_t *cd, gf_boolean_t lockless_update)
{
changelog_rt_t *crt = NULL;
@@ -30,10 +31,12 @@ changelog_rt_init (xlator_t *this, changelog_dispatcher_t *cd)
if (!crt)
return -1;
+ /* TBD: don't init (and destroy) if lock-less update */
LOCK_INIT (&crt->lock);
cd->cd_data = crt;
- cd->dispatchfn = &changelog_rt_enqueue;
+ cd->dispatchfn = lockless_update ?
+ &changelog_rt_enqueue_lockless : &changelog_rt_enqueue;
return 0;
}
@@ -52,8 +55,9 @@ changelog_rt_fini (xlator_t *this, changelog_dispatcher_t *cd)
}
int
-changelog_rt_enqueue (xlator_t *this, changelog_priv_t *priv, void *cbatch,
- changelog_log_data_t *cld_0, changelog_log_data_t *cld_1)
+changelog_rt_enqueue (xlator_t *this,
+ changelog_priv_t *priv, void *cbatch,
+ changelog_local_t *local, changelog_log_data_t *cld_0)
{
int ret = 0;
changelog_rt_t *crt = NULL;
@@ -62,11 +66,18 @@ changelog_rt_enqueue (xlator_t *this, changelog_priv_t *priv, void *cbatch,
LOCK (&crt->lock);
{
- ret = changelog_handle_change (this, priv, cld_0);
- if (!ret && cld_1)
- ret = changelog_handle_change (this, priv, cld_1);
+ ret = changelog_handle_change (this, priv, local, cld_0);
}
UNLOCK (&crt->lock);
return ret;
}
+
+int
+changelog_rt_enqueue_lockless (xlator_t *this,
+ changelog_priv_t *priv, void *cbatch,
+ changelog_local_t *local,
+ changelog_log_data_t *cld_0)
+{
+ return changelog_handle_change (this, priv, local, cld_0);
+}