summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-08-25 11:46:25 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-09-01 10:22:39 -0700
commitbefae0b48729894282b5b8b174907e24779c3442 (patch)
tree1f43412cb788a40ddc547e15fe71e16f39fd1442 /xlators/cluster/afr/src/afr-common.c
parent68b23745602e4cc6317d6dce72ed0392d4174972 (diff)
afr: Consume compound fops in afr transaction
Change-Id: Ib06ece3cce1b10d28d6d2953da28444f5c2457ad BUG: 1290304 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/15014 Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index dec667fd460..cf838846cbd 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -42,6 +42,7 @@
#include "afr-self-heal.h"
#include "afr-self-heald.h"
#include "afr-messages.h"
+#include "compound-fop-utils.h"
gf_boolean_t
afr_is_consistent_io_possible (afr_local_t *local, afr_private_t *priv,
@@ -4592,6 +4593,7 @@ afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno)
local->need_full_crawl = _gf_false;
+ local->compound = _gf_false;
INIT_LIST_HEAD (&local->healer);
return 0;
out:
@@ -4743,6 +4745,7 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
if (!local->pending)
goto out;
+ local->compound = _gf_false;
INIT_LIST_HEAD (&local->transaction.eager_locked);
ret = 0;
@@ -5536,3 +5539,55 @@ afr_get_msg_id (char *op_type)
return AFR_MSG_ADD_BRICK_STATUS;
return -1;
}
+
+gf_boolean_t
+afr_can_compound_pre_op_and_op (afr_private_t *priv, glusterfs_fop_t fop)
+{
+ if (priv->arbiter_count != 0)
+ return _gf_false;
+
+ if (!priv->use_compound_fops)
+ return _gf_false;
+
+ switch (fop) {
+ case GF_FOP_WRITE:
+ return _gf_true;
+ default:
+ return _gf_false;
+ }
+}
+
+afr_compound_cbk_t
+afr_pack_fop_args (call_frame_t *frame, compound_args_t *args,
+ glusterfs_fop_t fop, int index)
+{
+ afr_local_t *local = frame->local;
+
+ switch (fop) {
+ case GF_FOP_WRITE:
+ COMPOUND_PACK_ARGS (writev, GF_FOP_WRITE,
+ args, index,
+ local->fd, local->cont.writev.vector,
+ local->cont.writev.count,
+ local->cont.writev.offset,
+ local->cont.writev.flags,
+ local->cont.writev.iobref,
+ local->xdata_req);
+ return afr_pre_op_writev_cbk;
+ default:
+ break;
+ }
+ return NULL;
+}
+
+void
+afr_compound_cleanup (compound_args_t *args, dict_t *xdata,
+ dict_t *newloc_xdata)
+{
+ if (args)
+ compound_args_cleanup (args);
+ if (xdata)
+ dict_unref (xdata);
+ if (newloc_xdata)
+ dict_unref (newloc_xdata);
+}