summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2020-04-15 15:03:03 +0300
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-05-04 06:02:35 +0000
commit2ab575778d3c0c500e798ae83a41e700d118a6be (patch)
tree6af50cd1117d1dd908875959fb34504831ec3233
parent29d6b944b91df982f10581b0c17004089358e88c (diff)
core, cli, quota: cleanup malloc debugging and stats
1. Since mcheck()/mprobe() etc. features are no longer used, mcheck.h isn't required to be included. 2. Since mallinfo() is used to obtain malloc statistics, it should be detected instead of malloc_stats(). Change-Id: I54c7d2ee568e06ab29938efc01d1a2153c5bd5db Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1172
-rw-r--r--cli/src/cli.c6
-rw-r--r--configure.ac8
-rw-r--r--glusterfsd/src/glusterfsd.c6
-rw-r--r--libglusterfs/src/statedump.c4
-rw-r--r--xlators/features/quota/src/quota-enforcer-client.c6
5 files changed, 6 insertions, 24 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 2c96b7ae6e6..b42d29df9f5 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -33,12 +33,6 @@
#include <malloc.h>
#endif
-#ifdef HAVE_MALLOC_STATS
-#ifdef DEBUG
-#include <mcheck.h>
-#endif
-#endif
-
#include "cli.h"
#include "cli-quotad-client.h"
#include "cli-cmd.h"
diff --git a/configure.ac b/configure.ac
index 0d236f6c359..9b425cf5fd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,11 +915,11 @@ AC_TRY_COMPILE([#include <math.h>], [double x=0.0; x=ceil(0.0);],
fi
dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
-AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
-if test "x${have_malloc_stats}" = "xyes"; then
- AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
+AC_CHECK_FUNC([mallinfo], [have_mallinfo=yes])
+if test "x${have_mallinfo}" = "xyes"; then
+ AC_DEFINE(HAVE_MALLINFO, 1, [define if found mallinfo])
fi
-AC_SUBST(HAVE_MALLOC_STATS)
+AC_SUBST(HAVE_MALLINFO)
dnl Linux, Solaris, Cygwin
AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index e192795baac..44c6c419f36 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -47,12 +47,6 @@
#include <malloc.h>
#endif
-#ifdef HAVE_MALLOC_STATS
-#ifdef DEBUG
-#include <mcheck.h>
-#endif
-#endif
-
#include <glusterfs/xlator.h>
#include <glusterfs/glusterfs.h>
#include <glusterfs/compat.h>
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 5e0f04f3217..2d44c92c637 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -270,7 +270,7 @@ gf_proc_dump_xlator_mem_info_only_in_use(xlator_t *xl)
void
gf_proc_dump_mem_info()
{
-#ifdef HAVE_MALLOC_STATS
+#ifdef HAVE_MALLINFO
struct mallinfo info;
memset(&info, 0, sizeof(struct mallinfo));
@@ -296,7 +296,7 @@ gf_proc_dump_mem_info_to_dict(dict_t *dict)
{
if (!dict)
return;
-#ifdef HAVE_MALLOC_STATS
+#ifdef HAVE_MALLINFO
struct mallinfo info;
int ret = -1;
diff --git a/xlators/features/quota/src/quota-enforcer-client.c b/xlators/features/quota/src/quota-enforcer-client.c
index 097439d86d6..480d64ade27 100644
--- a/xlators/features/quota/src/quota-enforcer-client.c
+++ b/xlators/features/quota/src/quota-enforcer-client.c
@@ -32,12 +32,6 @@
#include <malloc.h>
#endif
-#ifdef HAVE_MALLOC_STATS
-#ifdef DEBUG
-#include <mcheck.h>
-#endif
-#endif
-
#include "quota.h"
#include "quota-messages.h"