From 6f6744730e34fa8a161b5f7f2a8ad3f8a7fc30fa Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 4 Apr 2013 19:35:11 -0700 Subject: afr: let eager-locking do its own overlap checks Today there is a non-obvious dependence of eager-locking on write-behind. The reason is that eager-locking works as long as the inheriting transaction has no overlaps with any of the transactions already in progress. While write-behind provides non-overlapping writes as a side-effect most of times (and only guarantees it when strict-write-ordering option is enabled, which is not on by default) eager-lock needs the behavior as a guarantee. This is leading to complex and unwanted checks for the presence of write-behind in the graph, for the simple task of checking for overlaps. This patch removes the interdependence between eager-locking and write-behind by making eager-locking do its own overlap checks with in-progress writes. Change-Id: Iccba1185aeb5f1e7f060089c895a62840787133f BUG: 912581 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/4782 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/cluster/afr/src/afr-common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/afr/src/afr-common.c') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 89d964056a0..a9acb409490 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -2520,6 +2520,8 @@ __afr_fd_ctx_set (xlator_t *this, fd_t *fd) INIT_LIST_HEAD (&fd_ctx->entries); fd_ctx->call_child = -1; + INIT_LIST_HEAD (&fd_ctx->eager_locked); + ret = __fd_ctx_set (fd, this, (uint64_t)(long) fd_ctx); if (ret) gf_log (this->name, GF_LOG_DEBUG, @@ -4086,8 +4088,9 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this) AFR_NUM_CHANGE_LOGS); if (!local->transaction.txn_changelog) goto out; - if (local->fd && (local->transaction.type == AFR_DATA_TRANSACTION)) - local->transaction.eager_lock_on = priv->eager_lock; + + INIT_LIST_HEAD (&local->transaction.eager_locked); + ret = 0; out: return ret; -- cgit