summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-09-06 15:09:42 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-09-19 12:52:36 +0000
commitdc2c632d525cd23914bdc468ef6cf4335559867f (patch)
treee55e31bb96475fedf2d566f4a91e9a9eaa946406 /xlators
parentd4770602e044424ff5a4a7ac666bf5a90490ec9b (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#1625961 Change-Id: I8fd1cf229aed54ce5abd4e6226351a039924dd91 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators')
-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) {