summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-04-22 13:33:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-04-23 06:32:52 -0700
commit582de0677da4be19fc6f873625c58c45d069ab1c (patch)
treef10cb3e26e1f92f6ea91034e6f7bb925790dd9bc /xlators/protocol/client
parent72baa17282f5cf749fa743fd601c7b728ece4fa2 (diff)
Memory accounting changes
Memory accounting Changes. Thanks to Vinayak Hegde and Csaba Henk for their contributions. Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client-mem-types.h43
-rw-r--r--xlators/protocol/client/src/client-protocol.c178
-rw-r--r--xlators/protocol/client/src/saved-frames.c13
3 files changed, 153 insertions, 81 deletions
diff --git a/xlators/protocol/client/src/client-mem-types.h b/xlators/protocol/client/src/client-mem-types.h
new file mode 100644
index 000000000..1eee8d931
--- /dev/null
+++ b/xlators/protocol/client/src/client-mem-types.h
@@ -0,0 +1,43 @@
+
+/*
+ Copyright (c) 2008-2009 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef __CLIENT_MEM_TYPES_H__
+#define __CLIENT_MEM_TYPES_H__
+
+#include "mem-types.h"
+
+enum gf_client_mem_types_ {
+ gf_client_mt_dir_entry_t = gf_common_mt_end + 1,
+ gf_client_mt_volfile_ctx,
+ gf_client_mt_client_state_t,
+ gf_client_mt_client_conf_t,
+ gf_client_mt_locker,
+ gf_client_mt_lock_table,
+ gf_client_mt_char,
+ gf_client_mt_client_connection_t,
+ gf_client_mt_client_fd_ctx_t,
+ gf_client_mt_client_local_t,
+ gf_client_mt_saved_frames,
+ gf_client_mt_saved_frame,
+ gf_client_mt_end
+};
+#endif
+
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index 36a31c5c9..df890cc3c 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -37,6 +37,7 @@
#include "compat.h"
#include "compat-errno.h"
#include "statedump.h"
+#include "client-mem-types.h"
#include <sys/resource.h>
#include <inttypes.h>
@@ -169,7 +170,7 @@ client_local_wipe (client_local_t *local)
if (local->fd)
fd_unref (local->fd);
- free (local);
+ GF_FREE (local);
}
return 0;
@@ -234,7 +235,7 @@ call_bail (void *data)
/* Chaining to get call-always functionality from
call-once timer */
if (conn->timer) {
- timer_cbk = conn->timer->cbk;
+ timer_cbk = conn->timer->callbk;
timeout.tv_sec = 10;
timeout.tv_usec = 0;
@@ -320,7 +321,7 @@ call_bail (void *data)
gf_ops[trav->op] (frame, &hdr, sizeof (hdr), NULL);
list_del_init (&trav->list);
- FREE (trav);
+ GF_FREE (trav);
}
out:
return;
@@ -507,7 +508,7 @@ client_start_ping (void *data)
return;
err:
if (hdr)
- FREE (hdr);
+ GF_FREE (hdr);
if (dummy_frame)
STACK_DESTROY (dummy_frame->root);
@@ -661,7 +662,7 @@ protocol_client_xfer (call_frame_t *frame, xlator_t *this, transport_t *trans,
gf_cbks[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
}
- FREE (hdr);
+ GF_FREE (hdr);
}
return ret;
@@ -695,7 +696,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
local->fd = fd_ref (fd);
@@ -735,7 +736,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, fd, NULL, NULL);
return 0;
@@ -765,7 +766,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
uint64_t gen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
local->fd = fd_ref (fd);
@@ -805,7 +806,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, fd);
return 0;
@@ -860,7 +861,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -916,7 +917,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -947,7 +948,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
uint64_t gen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, loc);
@@ -985,7 +986,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
return 0;
@@ -1014,7 +1015,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
uint64_t gen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, loc);
@@ -1051,7 +1052,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
return 0;
@@ -1107,7 +1108,7 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -1163,7 +1164,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -1195,7 +1196,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
uint64_t gen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, loc);
@@ -1232,7 +1233,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
return 0;
@@ -1312,7 +1313,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -1344,7 +1345,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
uint64_t newgen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, oldloc);
@@ -1395,7 +1396,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, oldloc->inode, NULL);
return 0;
}
@@ -1450,7 +1451,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -1523,7 +1524,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return 0;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL, 0, NULL);
return 0;
@@ -1596,7 +1597,7 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -1653,7 +1654,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -1721,7 +1722,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
return 0;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -1790,7 +1791,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -1844,7 +1845,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
req->dict_len = hton32 (dict_len);
if (dict) {
memcpy (req->dict, buf, dict_len);
- FREE (buf);
+ GF_FREE (buf);
}
req->ino = hton64 (ino);
@@ -1858,7 +1859,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -1942,7 +1943,7 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EBADFD, NULL);
return 0;
@@ -2019,7 +2020,7 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -2110,7 +2111,7 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -2170,7 +2171,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -2249,7 +2250,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -2308,7 +2309,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
}
@@ -2335,7 +2336,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc,
size_t pathlen = 0;
client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, loc);
@@ -2371,7 +2372,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, fd);
return 0;
@@ -2437,7 +2438,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return 0;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EBADFD, NULL);
return 0;
@@ -2505,7 +2506,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return 0;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EBADFD, NULL);
return 0;
@@ -2624,7 +2625,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -2693,7 +2694,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -2759,7 +2760,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd)
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -2857,7 +2858,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -2949,7 +2950,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -3056,7 +3057,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -3118,7 +3119,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -3196,7 +3197,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL);
return 0;
@@ -3230,7 +3231,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
client_local_t *local = NULL;
char *buf = NULL;
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
loc_copy (&local->loc, loc);
@@ -3281,7 +3282,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
if (dictlen > 0) {
memcpy (req->dict + pathlen + baselen, buf, dictlen);
- FREE (buf);
+ GF_FREE (buf);
}
req->dictlen = hton32 (dictlen);
@@ -3451,7 +3452,7 @@ client_fdctx_destroy (xlator_t *this, client_fd_ctx_t *fdctx)
out:
inode_unref (fdctx->inode);
- FREE (fdctx);
+ GF_FREE (fdctx);
return ret;
}
@@ -3598,7 +3599,7 @@ fail:
STACK_UNWIND (frame, op_ret, op_errno, dict);
if (dictbuf)
- free (dictbuf);
+ GF_FREE (dictbuf);
if (dict)
dict_unref (dict);
@@ -3657,7 +3658,7 @@ fail:
STACK_UNWIND (frame, op_ret, op_errno, dict);
if (dictbuf)
- free (dictbuf);
+ GF_FREE (dictbuf);
if (dict)
dict_unref (dict);
@@ -3724,7 +3725,8 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
local->loc.path);
}
- fdctx = CALLOC (1, sizeof (*fdctx));
+ fdctx = GF_CALLOC (1, sizeof (*fdctx),
+ gf_client_mt_client_fd_ctx_t);
if (!fdctx) {
op_ret = -1;
op_errno = ENOMEM;
@@ -3801,7 +3803,8 @@ client_open_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
}
if (op_ret >= 0) {
- fdctx = CALLOC (1, sizeof (*fdctx));
+ fdctx = GF_CALLOC (1, sizeof (*fdctx),
+ gf_client_mt_client_fd_ctx_t);
if (!fdctx) {
op_ret = -1;
op_errno = ENOMEM;
@@ -4521,7 +4524,8 @@ client_opendir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
}
if (op_ret >= 0) {
- fdctx = CALLOC (1, sizeof (*fdctx));
+ fdctx = GF_CALLOC (1, sizeof (*fdctx),
+ gf_client_mt_client_fd_ctx_t);
if (!fdctx) {
op_ret = -1;
op_errno = ENOMEM;
@@ -4719,7 +4723,7 @@ fail:
client_local_wipe (local);
if (dictbuf)
- free (dictbuf);
+ GF_FREE (dictbuf);
if (xattr)
dict_unref (xattr);
@@ -4790,13 +4794,13 @@ gf_free_direntry (dir_entry_t *head)
trav = head->next;
while (trav) {
prev->next = trav->next;
- FREE (trav->name);
+ GF_FREE (trav->name);
if (IA_ISLNK (trav->buf.ia_type))
- FREE (trav->link);
- FREE (trav);
+ GF_FREE (trav->link);
+ GF_FREE (trav);
trav = prev->next;
}
- FREE (head);
+ GF_FREE (head);
fail:
return 0;
}
@@ -4945,7 +4949,7 @@ fail:
client_local_wipe (local);
if (dictbuf)
- free (dictbuf);
+ GF_FREE (dictbuf);
if (dict)
dict_unref (dict);
@@ -5133,7 +5137,7 @@ client_getspec (call_frame_t *frame, xlator_t *this, const char *key,
return ret;
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
}
@@ -5203,7 +5207,7 @@ client_log (call_frame_t *frame, xlator_t *this, const char *msg)
unwind:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
STACK_UNWIND (frame, -1, EINVAL, NULL);
return 0;
@@ -5477,7 +5481,7 @@ protocol_client_reopendir (xlator_t *this, client_fd_ctx_t *fdctx)
goto out;
}
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
if (!local) {
goto out;
}
@@ -5523,7 +5527,7 @@ out:
client_local_wipe (local);
if (path)
- FREE (path);
+ GF_FREE (path);
return 0;
}
@@ -5600,7 +5604,7 @@ protocol_client_reopen (xlator_t *this, client_fd_ctx_t *fdctx)
goto out;
}
- local = calloc (1, sizeof (*local));
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_client_local_t);
if (!local) {
goto out;
}
@@ -5647,7 +5651,7 @@ out:
client_local_wipe (local);
if (path)
- FREE (path);
+ GF_FREE (path);
return 0;
@@ -6120,6 +6124,26 @@ protocol_client_interpret (xlator_t *this, transport_t *trans,
return ret;
}
+int32_t
+mem_acct_init (xlator_t *this)
+{
+ int ret = -1;
+
+ if (!this)
+ return ret;
+
+ ret = xlator_mem_acct_init (this, gf_client_mt_end + 1);
+
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
+ "failed");
+ return ret;
+ }
+
+ return ret;
+}
+
+
/*
* init - initiliazation function. called during loading of client protocol
* @this:
@@ -6179,7 +6203,8 @@ init (xlator_t *this)
ping_timeout = GF_UNIVERSAL_ANSWER;
}
- conf = CALLOC (1, sizeof (client_conf_t));
+ conf = GF_CALLOC (1, sizeof (client_conf_t),
+ gf_client_mt_client_conf_t);
pthread_mutex_init (&conf->mutex, NULL);
INIT_LIST_HEAD (&conf->saved_fds);
@@ -6189,7 +6214,7 @@ init (xlator_t *this)
for (i = 0; i < CHANNEL_MAX; i++) {
if (CHANNEL_LOWLAT == i) {
dict_set (this->options, "transport.socket.lowlat",
- data_from_dynstr (strdup ("true")));
+ data_from_dynstr (gf_strdup ("true")));
}
trans = transport_load (this->options, this);
if (trans == NULL) {
@@ -6199,7 +6224,8 @@ init (xlator_t *this)
goto out;
}
- conn = CALLOC (1, sizeof (*conn));
+ conn = GF_CALLOC (1, sizeof (*conn),
+ gf_client_mt_client_connection_t);
conn->saved_frames = saved_frames_new ();
@@ -6262,7 +6288,7 @@ fini (xlator_t *this)
this->private = NULL;
if (conf) {
- FREE (conf);
+ GF_FREE (conf);
}
return;
}
@@ -6288,8 +6314,8 @@ protocol_client_handshake (xlator_t *this, transport_t *trans)
GF_PROTOCOL_VERSION);
}
- ret = asprintf (&process_uuid_xl, "%s-%s", this->ctx->process_uuid,
- this->name);
+ ret = gf_asprintf (&process_uuid_xl, "%s-%s", this->ctx->process_uuid,
+ this->name);
if (-1 == ret) {
gf_log (this->name, GF_LOG_ERROR,
"asprintf failed while setting process_uuid");
@@ -6345,7 +6371,7 @@ protocol_client_handshake (xlator_t *this, transport_t *trans)
return ret;
fail:
if (hdr)
- free (hdr);
+ GF_FREE (hdr);
return ret;
}
@@ -6393,7 +6419,7 @@ protocol_client_pollin (xlator_t *this, transport_t *trans)
}
/* TODO: use mem-pool */
- FREE (hdr);
+ GF_FREE (hdr);
return ret;
}
diff --git a/xlators/protocol/client/src/saved-frames.c b/xlators/protocol/client/src/saved-frames.c
index cd5349e21..770de19ad 100644
--- a/xlators/protocol/client/src/saved-frames.c
+++ b/xlators/protocol/client/src/saved-frames.c
@@ -22,6 +22,7 @@
#include "common-utils.h"
#include "protocol.h"
#include "xlator.h"
+#include "client-mem-types.h"
@@ -30,7 +31,8 @@ saved_frames_new (void)
{
struct saved_frames *saved_frames = NULL;
- saved_frames = CALLOC (sizeof (*saved_frames), 1);
+ saved_frames = GF_CALLOC (sizeof (*saved_frames), 1,
+ gf_client_mt_saved_frames);
if (!saved_frames) {
return NULL;
}
@@ -76,7 +78,8 @@ saved_frames_put (struct saved_frames *frames, call_frame_t *frame,
head_frame = get_head_frame_for_type (frames, type);
- saved_frame = CALLOC (sizeof (*saved_frame), 1);
+ saved_frame = GF_CALLOC (sizeof (*saved_frame), 1,
+ gf_client_mt_saved_frame);
if (!saved_frame) {
return -ENOMEM;
}
@@ -119,7 +122,7 @@ saved_frames_get (struct saved_frames *frames, int32_t op,
if (saved_frame)
frame = saved_frame->frame;
- FREE (saved_frame);
+ GF_FREE (saved_frame);
return frame;
}
@@ -174,7 +177,7 @@ saved_frames_unwind (xlator_t *this, struct saved_frames *saved_frames,
gf_ops[trav->op] (frame, &hdr, sizeof (hdr), NULL);
list_del_init (&trav->list);
- FREE (trav);
+ GF_FREE (trav);
}
}
@@ -187,5 +190,5 @@ saved_frames_destroy (xlator_t *this, struct saved_frames *frames,
saved_frames_unwind (this, frames, &frames->mops, gf_mops, gf_mop_list);
saved_frames_unwind (this, frames, &frames->cbks, gf_cbks, gf_cbk_list);
- FREE (frames);
+ GF_FREE (frames);
}