summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2018-09-19 14:32:22 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-09-20 03:46:05 +0000
commit4f6ae853ffa9d06446407f389aaef61ac0b3b424 (patch)
treec96cf2566835a9c8513a073a94f83e2d1a5ba8fa /xlators/mgmt/glusterd/src/glusterd-utils.c
parent6a49bce014ac546582cf2409fd9933115406c808 (diff)
glusterd: Use GF_ATOMIC to update 'blockers' counter at glusterd_conf
Problem: Currently in glusterd code uses sync_lock/sync_unlock to update blockers counter which could add delays to the overall transaction phase escpecially when there's a batch of volume stop operations processed by glusterd in brick multiplexing mode. Solution: Use GF_ATOMIC to update blocker counter to ensure unnecessary context switching can be avoided. Change-Id: Ie13177dfee2af66687ae7cf5c67405c152853990 Fixes: bz#1631128 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 1214b6cbb19..7d611b11781 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5426,9 +5426,7 @@ my_callback(struct rpc_req *req, struct iovec *iov, int count, void *v_frame)
call_frame_t *frame = v_frame;
glusterd_conf_t *conf = frame->this->private;
- synclock_lock(&conf->big_lock);
- --(conf->blockers);
- synclock_unlock(&conf->big_lock);
+ GF_ATOMIC_DEC(conf->blockers);
STACK_DESTROY(frame->root);
return 0;
@@ -5524,9 +5522,7 @@ attach_brick_callback(struct rpc_req *req, struct iovec *iov, int count,
}
}
out:
- synclock_lock(&conf->big_lock);
- --(conf->blockers);
- synclock_unlock(&conf->big_lock);
+ GF_ATOMIC_DEC(conf->blockers);
STACK_DESTROY(frame->root);
return 0;
}
@@ -5613,7 +5609,7 @@ send_attach_req(xlator_t *this, struct rpc_clnt *rpc, char *path,
cbkfn = attach_brick_callback;
}
/* Send the msg */
- ++(conf->blockers);
+ GF_ATOMIC_INC(conf->blockers);
ret = rpc_clnt_submit(rpc, &gd_brick_prog, op, cbkfn, &iov, 1, NULL, 0,
iobref, frame, NULL, 0, NULL, 0, NULL);
return ret;
@@ -6347,7 +6343,7 @@ glusterd_restart_bricks(void *opaque)
}
conf->restart_bricks = _gf_true;
- ++(conf->blockers);
+ GF_ATOMIC_INC(conf->blockers);
ret = glusterd_get_quorum_cluster_counts(this, &active_count,
&quorum_count);
if (ret)
@@ -6456,7 +6452,7 @@ glusterd_restart_bricks(void *opaque)
ret = 0;
out:
- --(conf->blockers);
+ GF_ATOMIC_DEC(conf->blockers);
conf->restart_done = _gf_true;
conf->restart_bricks = _gf_false;