summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2016-10-27 11:51:47 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2017-02-01 19:59:25 -0500
commitc8a23cc6cd289dd28deb136bf2550f28e2761ef3 (patch)
tree0d094de18439a092fcbf4084a7a2d6b8bf02b1af /libglusterfs/src/common-utils.c
parentd7077bca4b372a056d23416294e729637e9af94e (diff)
libglusterfs+transport+io-threads: fix 256KB stack abuse
Some functions were allocating 64K booleans, which are (crazily) mapped to 4-byte ints, for a total of 256KB per call. Changed to use bitfields instead, so usage is now only 8KB per call. This was the impediment to changing the io-threads stack size, so that has been adjusted too. Change-Id: I8781c4f2c8f2b830f4535e366995fac8dd0a8653 BUG: 1418095 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: https://review.gluster.org/15745 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: N Balachandran <nbalacha@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index e180dd3eec0..c0884de8a5e 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3005,14 +3005,11 @@ out:
}
int
-gf_process_reserved_ports (gf_boolean_t *ports, uint32_t ceiling)
+gf_process_reserved_ports (unsigned char *ports, uint32_t ceiling)
{
int ret = -1;
- int i = 0;
- for (i = 0; i < GF_PORT_MAX; i++) {
- *(ports + i) = _gf_false;
- }
+ memset (ports, 0, GF_PORT_ARRAY_SIZE);
#if defined GF_LINUX_HOST_OS
char *ports_info = NULL;
@@ -3048,7 +3045,7 @@ out:
}
gf_boolean_t
-gf_ports_reserved (char *blocked_port, gf_boolean_t *ports, uint32_t ceiling)
+gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)
{
gf_boolean_t result = _gf_false;
char *range_port = NULL;
@@ -3070,7 +3067,7 @@ gf_ports_reserved (char *blocked_port, gf_boolean_t *ports, uint32_t ceiling)
} else {
gf_msg_debug ("glusterfs", 0, "blocking port "
"%d", tmp_port1);
- ports[tmp_port1] = _gf_true;
+ BIT_SET (ports, tmp_port1);
}
} else {
gf_msg ("glusterfs-socket", GF_LOG_WARNING, 0,
@@ -3108,7 +3105,7 @@ gf_ports_reserved (char *blocked_port, gf_boolean_t *ports, uint32_t ceiling)
gf_msg_debug ("glusterfs", 0, "lower: %d, higher: %d",
tmp_port1, tmp_port2);
for (; tmp_port1 <= tmp_port2; tmp_port1++)
- ports[tmp_port1] = _gf_true;
+ BIT_SET (ports, tmp_port1);
}
out: