diff options
author | Ravishankar N <ravishankar@redhat.com> | 2015-08-04 18:37:47 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-08-25 09:27:30 -0700 |
commit | f3c7e6eaa9b14b89c1d58c0edcb5664f28914437 (patch) | |
tree | 450350b00bbbee8264fa25fa55495eedfb4578e9 /xlators/cluster/afr/src/afr-transaction.c | |
parent | 255b4ba477f5163b59efee1c9f62845eb86067a2 (diff) |
afr: modify afr_txn_nothing_failed()
In an AFR transaction, we need to consider something as failed only if the
failure (either in the pre-op or the FOP phase) occurs on the bricks on which a
transaction lock was obtained.
Without this, we would end up considering the transaction as failure even on the
bricks on which the lock was not obtained, resulting in unnecessary fsyncs
during the post-op phase of every write transaction for non-appending writes.
Change-Id: Iee79e5d85dc7b4c41459d8bdd04a8454bdaf9a9d
BUG: 1250170
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/11827
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index ba50abd6d38..d773b5ace7a 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -493,18 +493,14 @@ afr_txn_nothing_failed (call_frame_t *frame, xlator_t *this) { afr_private_t *priv = NULL; afr_local_t *local = NULL; - int pre_op_count = 0; int i = 0; local = frame->local; priv = this->private; - pre_op_count = AFR_COUNT (local->transaction.pre_op, priv->child_count); - if (pre_op_count < priv->child_count) - return _gf_false; - for (i = 0; i < priv->child_count; i++) { - if (local->transaction.failed_subvols[i]) + if (local->transaction.pre_op[i] && + local->transaction.failed_subvols[i]) return _gf_false; } @@ -1156,14 +1152,9 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this) goto err; } - if (call_count > 1 && - (local->transaction.type == AFR_DATA_TRANSACTION || + if ((local->transaction.type == AFR_DATA_TRANSACTION || !local->optimistic_change_log)) { - /* If we are performing change on only one subvol, no - need to mark dirty, because we are setting the pending - counts already anyways - */ local->dirty[idx] = hton32(1); ret = dict_set_static_bin (xdata_req, AFR_DIRTY, local->dirty, |