|
|
7c2869 |
From b90d513a6e9685fd660f4997c035873a490ff577 Mon Sep 17 00:00:00 2001
|
|
|
7c2869 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
7c2869 |
Date: Fri, 2 Mar 2018 10:13:20 +0530
|
|
|
7c2869 |
Subject: [PATCH 670/675] cluster/afr: Remove compound-fops usage in afr
|
|
|
7c2869 |
|
|
|
7c2869 |
We are not seeing much improvement with this change. So removing the
|
|
|
7c2869 |
feature so that it doesn't need to be maintained anymore.
|
|
|
7c2869 |
|
|
|
7c2869 |
> Fixes: #414
|
|
|
7c2869 |
Upstream-patch: https://review.gluster.org/19655
|
|
|
7c2869 |
|
|
|
7c2869 |
BUG: 1583733
|
|
|
7c2869 |
Change-Id: I438b37a070f4b36ab4582f99c4b5d9fa37f29099
|
|
|
7c2869 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
7c2869 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/140575
|
|
|
7c2869 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
7c2869 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
7c2869 |
---
|
|
|
7c2869 |
tests/basic/afr/compounded-write-txns.t | 37 ----
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-common.c | 43 ----
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-transaction.c | 340 +-----------------------------
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-transaction.h | 4 +-
|
|
|
7c2869 |
xlators/cluster/afr/src/afr.c | 10 +-
|
|
|
7c2869 |
xlators/cluster/afr/src/afr.h | 14 --
|
|
|
7c2869 |
6 files changed, 7 insertions(+), 441 deletions(-)
|
|
|
7c2869 |
delete mode 100644 tests/basic/afr/compounded-write-txns.t
|
|
|
7c2869 |
|
|
|
7c2869 |
diff --git a/tests/basic/afr/compounded-write-txns.t b/tests/basic/afr/compounded-write-txns.t
|
|
|
7c2869 |
deleted file mode 100644
|
|
|
7c2869 |
index 7cecd87..0000000
|
|
|
7c2869 |
--- a/tests/basic/afr/compounded-write-txns.t
|
|
|
7c2869 |
+++ /dev/null
|
|
|
7c2869 |
@@ -1,37 +0,0 @@
|
|
|
7c2869 |
-#!/bin/bash
|
|
|
7c2869 |
-. $(dirname $0)/../../include.rc
|
|
|
7c2869 |
-. $(dirname $0)/../../volume.rc
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-cleanup
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST glusterd
|
|
|
7c2869 |
-TEST pidof glusterd
|
|
|
7c2869 |
-TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
|
|
|
7c2869 |
-TEST $CLI volume set $V0 write-behind off
|
|
|
7c2869 |
-TEST $CLI volume set $V0 client-io-threads off
|
|
|
7c2869 |
-TEST $CLI volume start $V0
|
|
|
7c2869 |
-TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-# Create and generate data into a src file
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST `printf %1024s |tr " " "1" > /tmp/source`
|
|
|
7c2869 |
-TEST `printf %1024s |tr " " "2" >> /tmp/source`
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST dd if=/tmp/source of=$M0/file bs=1024 count=2 2>/dev/null
|
|
|
7c2869 |
-md5sum_file=$(md5sum $M0/file | awk '{print $1}')
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST $CLI volume set $V0 cluster.use-compound-fops on
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST dd if=$M0/file of=$M0/file-copy bs=1024 count=2 2>/dev/null
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
|
|
|
7c2869 |
-TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-EXPECT "$md5sum_file" echo `md5sum $M0/file-copy | awk '{print $1}'`
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
|
|
|
7c2869 |
-TEST $CLI volume stop $V0
|
|
|
7c2869 |
-TEST $CLI volume delete $V0
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-TEST rm -f /tmp/source
|
|
|
7c2869 |
-cleanup
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
index cfd3d60..bffa71b 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
@@ -43,7 +43,6 @@
|
|
|
7c2869 |
#include "afr-self-heal.h"
|
|
|
7c2869 |
#include "afr-self-heald.h"
|
|
|
7c2869 |
#include "afr-messages.h"
|
|
|
7c2869 |
-#include "compound-fop-utils.h"
|
|
|
7c2869 |
|
|
|
7c2869 |
int32_t
|
|
|
7c2869 |
afr_quorum_errno (afr_private_t *priv)
|
|
|
7c2869 |
@@ -4747,7 +4746,6 @@ afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno)
|
|
|
7c2869 |
|
|
|
7c2869 |
local->need_full_crawl = _gf_false;
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->compound = _gf_false;
|
|
|
7c2869 |
INIT_LIST_HEAD (&local->healer);
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
out:
|
|
|
7c2869 |
@@ -4894,7 +4892,6 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
|
|
|
7c2869 |
if (!local->pending)
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->compound = _gf_false;
|
|
|
7c2869 |
INIT_LIST_HEAD (&local->transaction.eager_locked);
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = 0;
|
|
|
7c2869 |
@@ -5680,46 +5677,6 @@ afr_get_msg_id (char *op_type)
|
|
|
7c2869 |
return -1;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
-gf_boolean_t
|
|
|
7c2869 |
-afr_can_compound_pre_op_and_op (afr_private_t *priv, glusterfs_fop_t fop)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- if (priv->arbiter_count != 0)
|
|
|
7c2869 |
- return _gf_false;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (!priv->use_compound_fops)
|
|
|
7c2869 |
- return _gf_false;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (fop) {
|
|
|
7c2869 |
- case GF_FOP_WRITE:
|
|
|
7c2869 |
- return _gf_true;
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- return _gf_false;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-afr_compound_cbk_t
|
|
|
7c2869 |
-afr_pack_fop_args (call_frame_t *frame, compound_args_t *args,
|
|
|
7c2869 |
- glusterfs_fop_t fop, int index)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = frame->local;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (fop) {
|
|
|
7c2869 |
- case GF_FOP_WRITE:
|
|
|
7c2869 |
- COMPOUND_PACK_ARGS (writev, GF_FOP_WRITE,
|
|
|
7c2869 |
- args, index,
|
|
|
7c2869 |
- local->fd, local->cont.writev.vector,
|
|
|
7c2869 |
- local->cont.writev.count,
|
|
|
7c2869 |
- local->cont.writev.offset,
|
|
|
7c2869 |
- local->cont.writev.flags,
|
|
|
7c2869 |
- local->cont.writev.iobref,
|
|
|
7c2869 |
- local->xdata_req);
|
|
|
7c2869 |
- return afr_pre_op_writev_cbk;
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- return NULL;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_fav_child_reset_sink_xattrs_cbk (int ret, call_frame_t *heal_frame,
|
|
|
7c2869 |
void *opaque)
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
index 644ebe2..6672816 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
@@ -17,7 +17,6 @@
|
|
|
7c2869 |
#include "afr-transaction.h"
|
|
|
7c2869 |
#include "afr-self-heal.h"
|
|
|
7c2869 |
#include "afr-messages.h"
|
|
|
7c2869 |
-#include "compound-fop-utils.h"
|
|
|
7c2869 |
|
|
|
7c2869 |
#include <signal.h>
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -38,10 +37,6 @@ afr_changelog_call_count (afr_transaction_type type,
|
|
|
7c2869 |
unsigned char *failed_subvols,
|
|
|
7c2869 |
unsigned int child_count);
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_post_op_unlock_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
|
|
|
7c2869 |
- afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
- afr_xattrop_type_t op);
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
afr_changelog_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
|
|
|
7c2869 |
afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
afr_xattrop_type_t op);
|
|
|
7c2869 |
@@ -833,12 +828,10 @@ afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
afr_private_t *priv = this->private;
|
|
|
7c2869 |
afr_local_t *local = NULL;
|
|
|
7c2869 |
dict_t *xattr = NULL;
|
|
|
7c2869 |
- afr_fd_ctx_t *fd_ctx = NULL;
|
|
|
7c2869 |
int i = 0;
|
|
|
7c2869 |
int ret = 0;
|
|
|
7c2869 |
int idx = 0;
|
|
|
7c2869 |
int nothing_failed = 1;
|
|
|
7c2869 |
- gf_boolean_t compounded_unlock = _gf_true;
|
|
|
7c2869 |
gf_boolean_t need_undirty = _gf_false;
|
|
|
7c2869 |
|
|
|
7c2869 |
afr_handle_quorum (frame);
|
|
|
7c2869 |
@@ -904,36 +897,8 @@ afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
- if (local->compound && local->fd) {
|
|
|
7c2869 |
- LOCK (&local->fd->lock);
|
|
|
7c2869 |
- {
|
|
|
7c2869 |
- fd_ctx = __afr_fd_ctx_get (local->fd, this);
|
|
|
7c2869 |
- for (i = 0; i < priv->child_count; i++) {
|
|
|
7c2869 |
- if (local->transaction.pre_op[i] &&
|
|
|
7c2869 |
- local->transaction.eager_lock[i]) {
|
|
|
7c2869 |
- if (fd_ctx->lock_piggyback[i])
|
|
|
7c2869 |
- compounded_unlock = _gf_false;
|
|
|
7c2869 |
- else if (fd_ctx->lock_acquired[i])
|
|
|
7c2869 |
- compounded_unlock = _gf_false;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- if (compounded_unlock == _gf_false)
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- UNLOCK (&local->fd->lock);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- /* Do not compound if any brick got piggybacked lock as
|
|
|
7c2869 |
- * unlock should not be done for that. */
|
|
|
7c2869 |
- if (local->compound && compounded_unlock) {
|
|
|
7c2869 |
- afr_post_op_unlock_do (frame, this, xattr,
|
|
|
7c2869 |
- afr_changelog_post_op_done,
|
|
|
7c2869 |
- AFR_TRANSACTION_POST_OP);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- afr_changelog_do (frame, this, xattr,
|
|
|
7c2869 |
- afr_changelog_post_op_done,
|
|
|
7c2869 |
- AFR_TRANSACTION_POST_OP);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ afr_changelog_do (frame, this, xattr, afr_changelog_post_op_done,
|
|
|
7c2869 |
+ AFR_TRANSACTION_POST_OP);
|
|
|
7c2869 |
out:
|
|
|
7c2869 |
if (xattr)
|
|
|
7c2869 |
dict_unref (xattr);
|
|
|
7c2869 |
@@ -1267,68 +1232,6 @@ out:
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_pre_op_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
- int op_ret, int op_errno,
|
|
|
7c2869 |
- void *data, dict_t *xdata)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- call_frame_t *fop_frame = NULL;
|
|
|
7c2869 |
- default_args_cbk_t *write_args_cbk = NULL;
|
|
|
7c2869 |
- compound_args_cbk_t *args_cbk = data;
|
|
|
7c2869 |
- int call_count = -1;
|
|
|
7c2869 |
- int child_index = -1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
- child_index = (long) cookie;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (local->pre_op_compat)
|
|
|
7c2869 |
- afr_changelog_pre_op_update (frame, this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (op_ret == -1) {
|
|
|
7c2869 |
- local->op_errno = op_errno;
|
|
|
7c2869 |
- afr_transaction_fop_failed (frame, this, child_index);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- /* If the compound fop failed due to saved_frame_unwind(), then
|
|
|
7c2869 |
- * protocol/client fails it even before args_cbk is allocated.
|
|
|
7c2869 |
- * Handle that case by passing the op_ret, op_errno values explicitly.
|
|
|
7c2869 |
- */
|
|
|
7c2869 |
- if ((op_ret == -1) && (args_cbk == NULL)) {
|
|
|
7c2869 |
- afr_inode_write_fill (frame, this, child_index, op_ret,
|
|
|
7c2869 |
- op_errno, NULL, NULL, NULL);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- write_args_cbk = &args_cbk->rsp_list[1];
|
|
|
7c2869 |
- afr_inode_write_fill (frame, this, child_index,
|
|
|
7c2869 |
- write_args_cbk->op_ret,
|
|
|
7c2869 |
- write_args_cbk->op_errno,
|
|
|
7c2869 |
- &write_args_cbk->prestat,
|
|
|
7c2869 |
- &write_args_cbk->poststat,
|
|
|
7c2869 |
- write_args_cbk->xdata);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- call_count = afr_frame_return (frame);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (call_count == 0) {
|
|
|
7c2869 |
- compound_args_cleanup (local->c_args);
|
|
|
7c2869 |
- local->c_args = NULL;
|
|
|
7c2869 |
- afr_process_post_writev (frame, this);
|
|
|
7c2869 |
- if (!afr_txn_nothing_failed (frame, this)) {
|
|
|
7c2869 |
- /* Don't unwind until post-op is complete */
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- /* frame change, place frame in post-op delay and unwind */
|
|
|
7c2869 |
- fop_frame = afr_transaction_detach_fop_frame (frame);
|
|
|
7c2869 |
- afr_writev_copy_outvars (frame, fop_frame);
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
- afr_writev_unwind (fop_frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
afr_changelog_prepare (xlator_t *this, call_frame_t *frame, int *call_count,
|
|
|
7c2869 |
afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
afr_xattrop_type_t op, dict_t **xdata,
|
|
|
7c2869 |
@@ -1358,228 +1261,6 @@ afr_changelog_prepare (xlator_t *this, call_frame_t *frame, int *call_count,
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_pre_op_fop_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
|
|
|
7c2869 |
- afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
- afr_xattrop_type_t op)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- dict_t *xdata = NULL;
|
|
|
7c2869 |
- dict_t *newloc_xdata = NULL;
|
|
|
7c2869 |
- compound_args_t *args = NULL;
|
|
|
7c2869 |
- int i = 0, call_count = 0;
|
|
|
7c2869 |
- afr_compound_cbk_t compound_cbk;
|
|
|
7c2869 |
- int ret = 0;
|
|
|
7c2869 |
- int op_errno = ENOMEM;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- /* If lock failed on all, just unlock and unwind */
|
|
|
7c2869 |
- ret = afr_changelog_prepare (this, frame, &call_count, changelog_resume,
|
|
|
7c2869 |
- op, &xdata, &newloc_xdata);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (ret)
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local->call_count = call_count;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_save_lk_owner (frame);
|
|
|
7c2869 |
- frame->root->lk_owner =
|
|
|
7c2869 |
- local->transaction.main_frame->root->lk_owner;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- args = compound_fop_alloc (2, GF_CFOP_XATTROP_WRITEV, NULL);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (!args)
|
|
|
7c2869 |
- goto err;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- /* pack pre-op part */
|
|
|
7c2869 |
- i = 0;
|
|
|
7c2869 |
- COMPOUND_PACK_ARGS (fxattrop, GF_FOP_FXATTROP,
|
|
|
7c2869 |
- args, i,
|
|
|
7c2869 |
- local->fd, GF_XATTROP_ADD_ARRAY,
|
|
|
7c2869 |
- xattr, xdata);
|
|
|
7c2869 |
- i++;
|
|
|
7c2869 |
- /* pack whatever fop needs to be packed
|
|
|
7c2869 |
- * @compound_cbk holds the cbk that would need to be called
|
|
|
7c2869 |
- */
|
|
|
7c2869 |
- compound_cbk = afr_pack_fop_args (frame, args, local->op, i);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local->c_args = args;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- for (i = 0; i < priv->child_count; i++) {
|
|
|
7c2869 |
- /* Means lock did not succeed on this brick */
|
|
|
7c2869 |
- if (!local->transaction.pre_op[i] ||
|
|
|
7c2869 |
- local->transaction.failed_subvols[i])
|
|
|
7c2869 |
- continue;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- STACK_WIND_COOKIE (frame, compound_cbk,
|
|
|
7c2869 |
- (void *) (long) i,
|
|
|
7c2869 |
- priv->children[i],
|
|
|
7c2869 |
- priv->children[i]->fops->compound,
|
|
|
7c2869 |
- args,
|
|
|
7c2869 |
- NULL);
|
|
|
7c2869 |
- if (!--call_count)
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (xdata)
|
|
|
7c2869 |
- dict_unref (xdata);
|
|
|
7c2869 |
- if (newloc_xdata)
|
|
|
7c2869 |
- dict_unref (newloc_xdata);
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-err:
|
|
|
7c2869 |
- local->internal_lock.lock_cbk = local->transaction.done;
|
|
|
7c2869 |
- local->op_ret = -1;
|
|
|
7c2869 |
- local->op_errno = op_errno;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_restore_lk_owner (frame);
|
|
|
7c2869 |
- afr_unlock (frame, this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (xdata)
|
|
|
7c2869 |
- dict_unref (xdata);
|
|
|
7c2869 |
- if (newloc_xdata)
|
|
|
7c2869 |
- dict_unref (newloc_xdata);
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
-afr_post_op_unlock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
- int op_ret, int op_errno,
|
|
|
7c2869 |
- void *data, dict_t *xdata)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- compound_args_cbk_t *args_cbk = data;
|
|
|
7c2869 |
- int call_count = -1;
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- afr_inodelk_t *inodelk = NULL;
|
|
|
7c2869 |
- int32_t child_index = (long)cookie;
|
|
|
7c2869 |
- int i = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
- child_index = (long) cookie;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_update_uninodelk (local, int_lock, child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- LOCK (&frame->lock);
|
|
|
7c2869 |
- {
|
|
|
7c2869 |
- call_count = --int_lock->lk_call_count;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- UNLOCK (&frame->lock);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (call_count == 0) {
|
|
|
7c2869 |
- compound_args_cleanup (local->c_args);
|
|
|
7c2869 |
- local->c_args = NULL;
|
|
|
7c2869 |
- if (local->transaction.resume_stub) {
|
|
|
7c2869 |
- call_resume (local->transaction.resume_stub);
|
|
|
7c2869 |
- local->transaction.resume_stub = NULL;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- gf_msg_trace (this->name, 0,
|
|
|
7c2869 |
- "All internal locks unlocked");
|
|
|
7c2869 |
- int_lock->lock_cbk (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
-afr_post_op_unlock_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
|
|
|
7c2869 |
- afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
- afr_xattrop_type_t op)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- dict_t *xdata = NULL;
|
|
|
7c2869 |
- dict_t *newloc_xdata = NULL;
|
|
|
7c2869 |
- compound_args_t *args = NULL;
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- afr_inodelk_t *inodelk = NULL;
|
|
|
7c2869 |
- int i = 0;
|
|
|
7c2869 |
- int call_count = 0;
|
|
|
7c2869 |
- struct gf_flock flock = {0,};
|
|
|
7c2869 |
- int ret = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (afr_is_inodelk_transaction(local)) {
|
|
|
7c2869 |
- inodelk = afr_get_inodelk (int_lock, int_lock->domain);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- flock.l_start = inodelk->flock.l_start;
|
|
|
7c2869 |
- flock.l_len = inodelk->flock.l_len;
|
|
|
7c2869 |
- flock.l_type = F_UNLCK;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- ret = afr_changelog_prepare (this, frame, &call_count, changelog_resume,
|
|
|
7c2869 |
- op, &xdata, &newloc_xdata);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (ret)
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int_lock->lk_call_count = call_count;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int_lock->lock_cbk = local->transaction.done;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- args = compound_fop_alloc (2, GF_CFOP_XATTROP_UNLOCK, NULL);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (!args) {
|
|
|
7c2869 |
- local->op_ret = -1;
|
|
|
7c2869 |
- local->op_errno = ENOMEM;
|
|
|
7c2869 |
- afr_changelog_post_op_done (frame, this);
|
|
|
7c2869 |
- goto out;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- i = 0;
|
|
|
7c2869 |
- COMPOUND_PACK_ARGS (fxattrop, GF_FOP_FXATTROP,
|
|
|
7c2869 |
- args, i,
|
|
|
7c2869 |
- local->fd, GF_XATTROP_ADD_ARRAY,
|
|
|
7c2869 |
- xattr, xdata);
|
|
|
7c2869 |
- i++;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (afr_is_inodelk_transaction(local)) {
|
|
|
7c2869 |
- if (local->fd) {
|
|
|
7c2869 |
- COMPOUND_PACK_ARGS (finodelk, GF_FOP_FINODELK,
|
|
|
7c2869 |
- args, i,
|
|
|
7c2869 |
- int_lock->domain, local->fd,
|
|
|
7c2869 |
- F_SETLK, &flock, NULL);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- COMPOUND_PACK_ARGS (inodelk, GF_FOP_INODELK,
|
|
|
7c2869 |
- args, i,
|
|
|
7c2869 |
- int_lock->domain, &local->loc,
|
|
|
7c2869 |
- F_SETLK, &flock, NULL);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local->c_args = args;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- for (i = 0; i < priv->child_count; i++) {
|
|
|
7c2869 |
- if (!local->transaction.pre_op[i] ||
|
|
|
7c2869 |
- local->transaction.failed_subvols[i])
|
|
|
7c2869 |
- continue;
|
|
|
7c2869 |
- STACK_WIND_COOKIE (frame, afr_post_op_unlock_cbk,
|
|
|
7c2869 |
- (void *) (long) i,
|
|
|
7c2869 |
- priv->children[i],
|
|
|
7c2869 |
- priv->children[i]->fops->compound,
|
|
|
7c2869 |
- args,
|
|
|
7c2869 |
- NULL);
|
|
|
7c2869 |
- if (!--call_count)
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-out:
|
|
|
7c2869 |
- if (xdata)
|
|
|
7c2869 |
- dict_unref (xdata);
|
|
|
7c2869 |
- if (newloc_xdata)
|
|
|
7c2869 |
- dict_unref (newloc_xdata);
|
|
|
7c2869 |
- return 0;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
afr_changelog_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
|
|
|
7c2869 |
afr_changelog_resume_t changelog_resume,
|
|
|
7c2869 |
afr_xattrop_type_t op)
|
|
|
7c2869 |
@@ -1783,21 +1464,8 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
goto next;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
- /* Till here we have already decided if pre-op needs to be done,
|
|
|
7c2869 |
- * based on various criteria. The only thing that needs to be checked
|
|
|
7c2869 |
- * now on is whether compound-fops is enabled or not.
|
|
|
7c2869 |
- * If it is, then perform pre-op and fop together for writev op.
|
|
|
7c2869 |
- */
|
|
|
7c2869 |
- if (afr_can_compound_pre_op_and_op (priv, local->op)) {
|
|
|
7c2869 |
- local->compound = _gf_true;
|
|
|
7c2869 |
- afr_pre_op_fop_do (frame, this, xdata_req,
|
|
|
7c2869 |
- afr_transaction_perform_fop,
|
|
|
7c2869 |
- AFR_TRANSACTION_PRE_OP);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- afr_changelog_do (frame, this, xdata_req,
|
|
|
7c2869 |
- afr_transaction_perform_fop,
|
|
|
7c2869 |
- AFR_TRANSACTION_PRE_OP);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ afr_changelog_do (frame, this, xdata_req, afr_transaction_perform_fop,
|
|
|
7c2869 |
+ AFR_TRANSACTION_PRE_OP);
|
|
|
7c2869 |
|
|
|
7c2869 |
if (xdata_req)
|
|
|
7c2869 |
dict_unref (xdata_req);
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
index dd19e5b..d01e144 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
@@ -58,7 +58,5 @@ afr_pick_error_xdata (afr_local_t *local, afr_private_t *priv,
|
|
|
7c2869 |
inode_t *inode1, unsigned char *readable1,
|
|
|
7c2869 |
inode_t *inode2, unsigned char *readable2);
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_pre_op_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
- int op_ret, int op_errno,
|
|
|
7c2869 |
- void *data, dict_t *xdata);
|
|
|
7c2869 |
+afr_transaction_resume (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
#endif /* __TRANSACTION_H__ */
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
index fc56486..c0e9d9c 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
@@ -216,9 +216,6 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7c2869 |
out);
|
|
|
7c2869 |
GF_OPTION_RECONF ("locking-scheme", priv->locking_scheme, options, str,
|
|
|
7c2869 |
out);
|
|
|
7c2869 |
- GF_OPTION_RECONF ("use-compound-fops", priv->use_compound_fops,
|
|
|
7c2869 |
- options, bool,
|
|
|
7c2869 |
- out);
|
|
|
7c2869 |
GF_OPTION_RECONF ("granular-entry-heal", priv->esh_granular, options,
|
|
|
7c2869 |
bool, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -422,8 +419,6 @@ init (xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
GF_OPTION_INIT ("pre-op-compat", priv->pre_op_compat, bool, out);
|
|
|
7c2869 |
GF_OPTION_INIT ("locking-scheme", priv->locking_scheme, str, out);
|
|
|
7c2869 |
- GF_OPTION_INIT ("use-compound-fops", priv->use_compound_fops,
|
|
|
7c2869 |
- bool, out);
|
|
|
7c2869 |
GF_OPTION_INIT ("granular-entry-heal", priv->esh_granular, bool, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
GF_OPTION_INIT ("eager-lock", priv->eager_lock, bool, out);
|
|
|
7c2869 |
@@ -949,9 +944,8 @@ struct volume_options options[] = {
|
|
|
7c2869 |
{ .key = {"use-compound-fops"},
|
|
|
7c2869 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
7c2869 |
.default_value = "no",
|
|
|
7c2869 |
- .description = "Use compound fops framework to modify afr "
|
|
|
7c2869 |
- "transaction such that network roundtrips are "
|
|
|
7c2869 |
- "reduced, thus improving the performance.",
|
|
|
7c2869 |
+ .description = "this option exists only for backward compatibility "
|
|
|
7c2869 |
+ "and configuring it doesn't have any effect"
|
|
|
7c2869 |
},
|
|
|
7c2869 |
{ .key = {NULL} },
|
|
|
7c2869 |
};
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
index 304efa1..58f881e 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
@@ -44,11 +44,6 @@ typedef int (*afr_inode_refresh_cbk_t) (call_frame_t *frame, xlator_t *this, int
|
|
|
7c2869 |
|
|
|
7c2869 |
typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
|
|
|
7c2869 |
-typedef int (*afr_compound_cbk_t) (call_frame_t *frame, void *cookie,
|
|
|
7c2869 |
- xlator_t *this, int op_ret, int op_errno,
|
|
|
7c2869 |
- void *data, dict_t *xdata);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-
|
|
|
7c2869 |
#define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr;})
|
|
|
7c2869 |
#define AFR_COUNT(array,max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res;})
|
|
|
7c2869 |
#define AFR_INTERSECT(dst,src1,src2,max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i];})
|
|
|
7c2869 |
@@ -169,7 +164,6 @@ typedef struct _afr_private {
|
|
|
7c2869 |
gf_boolean_t use_afr_in_pump;
|
|
|
7c2869 |
char *locking_scheme;
|
|
|
7c2869 |
gf_boolean_t esh_granular;
|
|
|
7c2869 |
- gf_boolean_t use_compound_fops;
|
|
|
7c2869 |
} afr_private_t;
|
|
|
7c2869 |
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -820,9 +814,7 @@ typedef struct _afr_local {
|
|
|
7c2869 |
call_frame_t *heal_frame;
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_boolean_t need_full_crawl;
|
|
|
7c2869 |
- gf_boolean_t compound;
|
|
|
7c2869 |
afr_fop_lock_state_t fop_lock_state;
|
|
|
7c2869 |
- compound_args_t *c_args;
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_boolean_t is_read_txn;
|
|
|
7c2869 |
} afr_local_t;
|
|
|
7c2869 |
@@ -1213,12 +1205,6 @@ afr_writev_copy_outvars (call_frame_t *src_frame, call_frame_t *dst_frame);
|
|
|
7c2869 |
void
|
|
|
7c2869 |
afr_update_uninodelk (afr_local_t *local, afr_internal_lock_t *int_lock,
|
|
|
7c2869 |
int32_t child_index);
|
|
|
7c2869 |
-gf_boolean_t
|
|
|
7c2869 |
-afr_can_compound_pre_op_and_op (afr_private_t *priv, glusterfs_fop_t fop);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-afr_compound_cbk_t
|
|
|
7c2869 |
-afr_pack_fop_args (call_frame_t *frame, compound_args_t *args,
|
|
|
7c2869 |
- glusterfs_fop_t fop, int index);
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_is_inodelk_transaction(afr_local_t *local);
|
|
|
7c2869 |
|
|
|
7c2869 |
--
|
|
|
7c2869 |
1.8.3.1
|
|
|
7c2869 |
|