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-quota.c | |
parent | 4f6749aa308152dc6350632991a6ae11b8467fb1 (diff) | |
download | glusterfs-4bd4b0a9437189cef439833a0ed70005db9f8409.tar.gz glusterfs-4bd4b0a9437189cef439833a0ed70005db9f8409.tar.xz glusterfs-4bd4b0a9437189cef439833a0ed70005db9f8409.zip |
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-quota.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 010e6beec8..a0848cdf0c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -2050,7 +2050,6 @@ glusterd_op_stage_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict) { int ret = 0; char *volname = NULL; - gf_boolean_t exists = _gf_false; int type = 0; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; @@ -2074,12 +2073,6 @@ glusterd_op_stage_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict) goto out; } - exists = glusterd_check_volume_exists(volname); - if (!exists) { - gf_asprintf(op_errstr, FMTSTR_CHECK_VOL_EXISTS, volname); - ret = -1; - goto out; - } ret = glusterd_volinfo_find(volname, &volinfo); if (ret) { gf_asprintf(op_errstr, FMTSTR_CHECK_VOL_EXISTS, volname); |