diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2019-04-03 08:27:05 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-04-08 13:07:42 +0000 |
commit | 4bd4b0a9437189cef439833a0ed70005db9f8409 (patch) | |
tree | 39cb52b6db95421bce034d3740ffa36970912ab7 /xlators/mgmt/glusterd/src/glusterd-log-ops.c | |
parent | 4f6749aa308152dc6350632991a6ae11b8467fb1 (diff) |
glusterd: remove redundant glusterd_check_volume_exists () calls
A pattern of following was found in multiple places where both
glusterd_check_volume_exists and glusterd_volinfo_find do the same job.
We just need one of them not both. In a scaled environment having many
volumes this is a bottleneck to iterate over the volume list to find a
volume twice!
exists = glusterd_check_volume_exists(volname);
ret = glusterd_volinfo_find(volname, &volinfo);
if ((ret) || (!exists)) {
Credits: ykaul@redhat.com for finding this out
Updates: bz#1193929
Change-Id: Ie116fe5c93e261a2bddd267c28ccb20a2884a36f
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-log-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-log-ops.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c index a202481d99a..5e0877e836c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c @@ -105,7 +105,6 @@ glusterd_op_stage_log_rotate(dict_t *dict, char **op_errstr) int ret = -1; char *volname = NULL; glusterd_volinfo_t *volinfo = NULL; - gf_boolean_t exists = _gf_false; char msg[2048] = {0}; char *brick = NULL; @@ -116,13 +115,11 @@ glusterd_op_stage_log_rotate(dict_t *dict, char **op_errstr) goto out; } - exists = glusterd_check_volume_exists(volname); ret = glusterd_volinfo_find(volname, &volinfo); - if (!exists) { + if (ret) { snprintf(msg, sizeof(msg), "Volume %s does not exist", volname); gf_msg("glusterd", GF_LOG_ERROR, 0, GD_MSG_VOL_NOT_FOUND, "%s", msg); *op_errstr = gf_strdup(msg); - ret = -1; goto out; } |