summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-03-02 10:13:20 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-03-06 07:55:25 +0000
commit9be043159a514db68b336c6aea49613f3125c5e0 (patch)
tree1156668fc7b8fe9a5349fb021c527c6cb2ede6e5 /xlators/cluster/afr/src/afr-transaction.c
parente8446ef31234b44f29bb9a77081023927ef1404d (diff)
cluster/afr: Remove compound-fops usage in afr
We are not seeing much improvement with this change. So removing the feature so that it doesn't need to be maintained anymore. Fixes: #414 Change-Id: Ic7969b151544daf2547bd262a9fa03f575626411 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c333
1 files changed, 4 insertions, 329 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 1f4ba71d5f8..a9f5d3db19c 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -17,7 +17,6 @@
#include "afr-transaction.h"
#include "afr-self-heal.h"
#include "afr-messages.h"
-#include "compound-fop-utils.h"
#include <signal.h>
@@ -38,10 +37,6 @@ afr_changelog_call_count (afr_transaction_type type,
unsigned char *failed_subvols,
unsigned int child_count);
int
-afr_post_op_unlock_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
- afr_changelog_resume_t changelog_resume,
- afr_xattrop_type_t op);
-int
afr_changelog_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
afr_changelog_resume_t changelog_resume,
afr_xattrop_type_t op);
@@ -847,12 +842,10 @@ afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = this->private;
afr_local_t *local = NULL;
dict_t *xattr = NULL;
- afr_fd_ctx_t *fd_ctx = NULL;
int i = 0;
int ret = 0;
int idx = 0;
int nothing_failed = 1;
- gf_boolean_t compounded_unlock = _gf_true;
gf_boolean_t need_undirty = _gf_false;
afr_handle_quorum (frame);
@@ -918,36 +911,8 @@ afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this)
goto out;
}
- if (local->compound && local->fd) {
- LOCK (&local->fd->lock);
- {
- fd_ctx = __afr_fd_ctx_get (local->fd, this);
- for (i = 0; i < priv->child_count; i++) {
- if (local->transaction.pre_op[i] &&
- local->transaction.eager_lock[i]) {
- if (fd_ctx->lock_piggyback[i])
- compounded_unlock = _gf_false;
- else if (fd_ctx->lock_acquired[i])
- compounded_unlock = _gf_false;
- }
- if (compounded_unlock == _gf_false)
- break;
- }
- }
- UNLOCK (&local->fd->lock);
- }
-
- /* Do not compound if any brick got piggybacked lock as
- * unlock should not be done for that. */
- if (local->compound && compounded_unlock) {
- afr_post_op_unlock_do (frame, this, xattr,
- afr_changelog_post_op_done,
- AFR_TRANSACTION_POST_OP);
- } else {
- afr_changelog_do (frame, this, xattr,
- afr_changelog_post_op_done,
- AFR_TRANSACTION_POST_OP);
- }
+ afr_changelog_do (frame, this, xattr, afr_changelog_post_op_done,
+ AFR_TRANSACTION_POST_OP);
out:
if (xattr)
dict_unref (xattr);
@@ -1275,66 +1240,6 @@ out:
}
int
-afr_pre_op_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno,
- void *data, dict_t *xdata)
-{
- afr_local_t *local = NULL;
- call_frame_t *fop_frame = NULL;
- default_args_cbk_t *write_args_cbk = NULL;
- compound_args_cbk_t *args_cbk = data;
- int call_count = -1;
- int child_index = -1;
-
- local = frame->local;
- child_index = (long) cookie;
-
- if (local->pre_op_compat)
- afr_changelog_pre_op_update (frame, this);
-
- if (op_ret == -1) {
- local->op_errno = op_errno;
- afr_transaction_fop_failed (frame, this, child_index);
- }
-
- /* If the compound fop failed due to saved_frame_unwind(), then
- * protocol/client fails it even before args_cbk is allocated.
- * Handle that case by passing the op_ret, op_errno values explicitly.
- */
- if ((op_ret == -1) && (args_cbk == NULL)) {
- afr_inode_write_fill (frame, this, child_index, op_ret,
- op_errno, NULL, NULL, NULL);
- } else {
- write_args_cbk = &args_cbk->rsp_list[1];
- afr_inode_write_fill (frame, this, child_index,
- write_args_cbk->op_ret,
- write_args_cbk->op_errno,
- &write_args_cbk->prestat,
- &write_args_cbk->poststat,
- write_args_cbk->xdata);
- }
-
- call_count = afr_frame_return (frame);
-
- if (call_count == 0) {
- compound_args_cleanup (local->c_args);
- local->c_args = NULL;
- afr_process_post_writev (frame, this);
- if (!afr_txn_nothing_failed (frame, this)) {
- /* Don't unwind until post-op is complete */
- local->transaction.resume (frame, this);
- } else {
- /* frame change, place frame in post-op delay and unwind */
- fop_frame = afr_transaction_detach_fop_frame (frame);
- afr_writev_copy_outvars (frame, fop_frame);
- local->transaction.resume (frame, this);
- afr_writev_unwind (fop_frame, this);
- }
- }
- return 0;
-}
-
-int
afr_changelog_prepare (xlator_t *this, call_frame_t *frame, int *call_count,
afr_changelog_resume_t changelog_resume,
afr_xattrop_type_t op, dict_t **xdata,
@@ -1364,223 +1269,6 @@ afr_changelog_prepare (xlator_t *this, call_frame_t *frame, int *call_count,
}
int
-afr_pre_op_fop_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
- afr_changelog_resume_t changelog_resume,
- afr_xattrop_type_t op)
-{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
- dict_t *xdata = NULL;
- dict_t *newloc_xdata = NULL;
- compound_args_t *args = NULL;
- int i = 0, call_count = 0;
- afr_compound_cbk_t compound_cbk;
- int ret = 0;
- int op_errno = ENOMEM;
-
- local = frame->local;
- priv = this->private;
-
- /* If lock failed on all, just unlock and unwind */
- ret = afr_changelog_prepare (this, frame, &call_count, changelog_resume,
- op, &xdata, &newloc_xdata);
-
- if (ret)
- return 0;
-
- local->call_count = call_count;
-
- afr_save_lk_owner (frame);
- frame->root->lk_owner =
- local->transaction.main_frame->root->lk_owner;
-
- args = compound_fop_alloc (2, GF_CFOP_XATTROP_WRITEV, NULL);
-
- if (!args)
- goto err;
-
- /* pack pre-op part */
- i = 0;
- COMPOUND_PACK_ARGS (fxattrop, GF_FOP_FXATTROP,
- args, i,
- local->fd, GF_XATTROP_ADD_ARRAY,
- xattr, xdata);
- i++;
- /* pack whatever fop needs to be packed
- * @compound_cbk holds the cbk that would need to be called
- */
- compound_cbk = afr_pack_fop_args (frame, args, local->op, i);
-
- local->c_args = args;
-
- for (i = 0; i < priv->child_count; i++) {
- /* Means lock did not succeed on this brick */
- if (!local->transaction.pre_op[i] ||
- local->transaction.failed_subvols[i])
- continue;
-
- STACK_WIND_COOKIE (frame, compound_cbk,
- (void *) (long) i,
- priv->children[i],
- priv->children[i]->fops->compound,
- args,
- NULL);
- if (!--call_count)
- break;
- }
-
- if (xdata)
- dict_unref (xdata);
- if (newloc_xdata)
- dict_unref (newloc_xdata);
- return 0;
-err:
- local->internal_lock.lock_cbk = local->transaction.done;
- local->op_ret = -1;
- local->op_errno = op_errno;
-
- afr_restore_lk_owner (frame);
- afr_unlock (frame, this);
-
- if (xdata)
- dict_unref (xdata);
- if (newloc_xdata)
- dict_unref (newloc_xdata);
- return 0;
-}
-
-int
-afr_post_op_unlock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno,
- void *data, dict_t *xdata)
-{
- afr_local_t *local = NULL;
- int call_count = -1;
- afr_internal_lock_t *int_lock = NULL;
- int32_t child_index = (long)cookie;
-
- local = frame->local;
- child_index = (long) cookie;
-
- local = frame->local;
- int_lock = &local->internal_lock;
-
- afr_update_uninodelk (local, int_lock, child_index);
-
- LOCK (&frame->lock);
- {
- call_count = --int_lock->lk_call_count;
- }
- UNLOCK (&frame->lock);
-
- if (call_count == 0) {
- compound_args_cleanup (local->c_args);
- local->c_args = NULL;
- if (local->transaction.resume_stub) {
- call_resume (local->transaction.resume_stub);
- local->transaction.resume_stub = NULL;
- }
- gf_msg_trace (this->name, 0,
- "All internal locks unlocked");
- int_lock->lock_cbk (frame, this);
- }
-
- return 0;
-}
-
-int
-afr_post_op_unlock_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
- afr_changelog_resume_t changelog_resume,
- afr_xattrop_type_t op)
-{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
- dict_t *xdata = NULL;
- dict_t *newloc_xdata = NULL;
- compound_args_t *args = NULL;
- afr_internal_lock_t *int_lock = NULL;
- afr_inodelk_t *inodelk = NULL;
- int i = 0;
- int call_count = 0;
- struct gf_flock flock = {0,};
- int ret = 0;
-
- local = frame->local;
- priv = this->private;
- int_lock = &local->internal_lock;
-
- if (afr_is_inodelk_transaction(local)) {
- inodelk = afr_get_inodelk (int_lock, int_lock->domain);
-
- flock.l_start = inodelk->flock.l_start;
- flock.l_len = inodelk->flock.l_len;
- flock.l_type = F_UNLCK;
- }
-
- ret = afr_changelog_prepare (this, frame, &call_count, changelog_resume,
- op, &xdata, &newloc_xdata);
-
- if (ret)
- return 0;
-
- int_lock->lk_call_count = call_count;
-
- int_lock->lock_cbk = local->transaction.done;
-
- args = compound_fop_alloc (2, GF_CFOP_XATTROP_UNLOCK, NULL);
-
- if (!args) {
- local->op_ret = -1;
- local->op_errno = ENOMEM;
- afr_changelog_post_op_done (frame, this);
- goto out;
- }
-
- i = 0;
- COMPOUND_PACK_ARGS (fxattrop, GF_FOP_FXATTROP,
- args, i,
- local->fd, GF_XATTROP_ADD_ARRAY,
- xattr, xdata);
- i++;
-
- if (afr_is_inodelk_transaction(local)) {
- if (local->fd) {
- COMPOUND_PACK_ARGS (finodelk, GF_FOP_FINODELK,
- args, i,
- int_lock->domain, local->fd,
- F_SETLK, &flock, NULL);
- } else {
- COMPOUND_PACK_ARGS (inodelk, GF_FOP_INODELK,
- args, i,
- int_lock->domain, &local->loc,
- F_SETLK, &flock, NULL);
- }
- }
-
- local->c_args = args;
-
- for (i = 0; i < priv->child_count; i++) {
- if (!local->transaction.pre_op[i] ||
- local->transaction.failed_subvols[i])
- continue;
- STACK_WIND_COOKIE (frame, afr_post_op_unlock_cbk,
- (void *) (long) i,
- priv->children[i],
- priv->children[i]->fops->compound,
- args,
- NULL);
- if (!--call_count)
- break;
- }
-out:
- if (xdata)
- dict_unref (xdata);
- if (newloc_xdata)
- dict_unref (newloc_xdata);
- return 0;
-}
-
-int
afr_changelog_do (call_frame_t *frame, xlator_t *this, dict_t *xattr,
afr_changelog_resume_t changelog_resume,
afr_xattrop_type_t op)
@@ -1791,21 +1479,8 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
goto next;
}
- /* Till here we have already decided if pre-op needs to be done,
- * based on various criteria. The only thing that needs to be checked
- * now on is whether compound-fops is enabled or not.
- * If it is, then perform pre-op and fop together for writev op.
- */
- if (afr_can_compound_pre_op_and_op (priv, local->op)) {
- local->compound = _gf_true;
- afr_pre_op_fop_do (frame, this, xdata_req,
- afr_transaction_perform_fop,
- AFR_TRANSACTION_PRE_OP);
- } else {
- afr_changelog_do (frame, this, xdata_req,
- afr_transaction_perform_fop,
- AFR_TRANSACTION_PRE_OP);
- }
+ afr_changelog_do (frame, this, xdata_req, afr_transaction_perform_fop,
+ AFR_TRANSACTION_PRE_OP);
if (xdata_req)
dict_unref (xdata_req);