summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-09-06 15:09:42 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-10-05 14:37:01 +0000
commit320901d1dc9e1d4b2985e7277ca22816e7936f2f (patch)
treef6cd368375cb7c1b7c9872f0d88fd0222720068a
parent5254a4b0c15ff75502806cc61a9eb9d21b55d411 (diff)
cluster/afr: Batch writes in same lock even when multiple fds are open
Problem: When eager-lock is disabled because of multiple-fds opened and app writes come on conflicting regions, the number of locks grows very fast leading to all the CPU being spent just in locking and unlocking by traversing huge queues in locks xlator for granting locks. Fix: Reduce the number of locks in transit by bundling the writes in the same lock and disable delayed piggy-pack when we learn that multiple fds are open on the file. This will reduce the size of queues in the locks xlator. This also reduces the number of network calls like inodelk/fxattrop. Please note that this problem can still happen if eager-lock is disabled as the writes will not be bundled in the same lock. fixes bz#1635975 Change-Id: I8fd1cf229aed54ce5abd4e6226351a039924dd91 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 3a542ceca43..dae4c8234e9 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -2286,9 +2286,6 @@ __need_previous_lock_unlocked(afr_local_t *local)
{
afr_lock_t *lock = NULL;
- if (!local->transaction.eager_lock_on)
- return _gf_true;
-
lock = &local->inode_ctx->lock[local->transaction.type];
if (!lock->acquired)
return _gf_false;
@@ -2305,10 +2302,8 @@ __afr_eager_lock_handle(afr_local_t *local, gf_boolean_t *take_lock,
afr_local_t *owner_local = NULL;
xlator_t *this = local->transaction.frame->this;
- if (local->fd && !afr_are_multiple_fds_opened(local, this)) {
- local->transaction.eager_lock_on = _gf_true;
- afr_set_lk_owner(local->transaction.frame, this, local->inode);
- }
+ local->transaction.eager_lock_on = _gf_true;
+ afr_set_lk_owner(local->transaction.frame, this, local->inode);
lock = &local->inode_ctx->lock[local->transaction.type];
if (__need_previous_lock_unlocked(local)) {
@@ -2325,8 +2320,6 @@ __afr_eager_lock_handle(afr_local_t *local, gf_boolean_t *take_lock,
lock->delay_timer = NULL;
}
}
- if (!local->transaction.eager_lock_on)
- goto out;
}
if (lock->release) {