summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-pmap.c
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2016-03-29 13:46:07 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-30 12:44:23 -0700
commitd5b583be1e677637015fabeaac81994f382f14bc (patch)
treefba29ca477eec8741ae5a60a00f15193d30cb4af /xlators/mgmt/glusterd/src/glusterd-pmap.c
parentdd02c5af9acb77cddc3bbe1ce9a51b7428b24446 (diff)
glusterd: scan for open ports only in required range
It does not make sense to keep track of free ports from 0 to base_port if we are not going to use them. glusterd start times without this patch 2.622 2.478 2.455 2.590 2.400 glusterd start times with this patch 1.9 1.9 1.9 2.0 2.0 1.8 We save around half a second for every glusterd start. BUG: 1322237 Change-Id: I0456689d0afad50dd068f2325ebfca9bdeffe01a Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/13841 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-pmap.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 5fc7f2c48b5..cd062483e72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -59,16 +59,16 @@ pmap_registry_new (xlator_t *this)
if (!pmap)
return NULL;
- for (i = 0; i < 65536; i++) {
+ pmap->base_port = pmap->last_alloc =
+ ((glusterd_conf_t *)(this->private))->base_port;
+
+ for (i = pmap->base_port; i < 65536; i++) {
if (pmap_port_isfree (i))
pmap->ports[i].type = GF_PMAP_PORT_FREE;
else
pmap->ports[i].type = GF_PMAP_PORT_FOREIGN;
}
- pmap->base_port = pmap->last_alloc =
- ((glusterd_conf_t *)(this->private))->base_port;
-
return pmap;
}