[PATCH] ctdb-server: Introduce mem pool
Swen Schillig
swen at vnet.ibm.com
Fri Mar 9 08:09:23 UTC 2018
Please review and push if OK.
Thanks in advance.
Cheers Swen
-------------- next part --------------
From 8defb7c63e960d36e25986884a1fc1215f762ce1 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Thu, 8 Feb 2018 11:46:03 +0100
Subject: [PATCH] ctdb-server: Introduce mem pool
The three conesecutive calls to memory allocating functions are predicitve
in their size requirements and therefore it is worthwhile to introduce
a memory pool.
Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
ctdb/server/ctdb_call.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 623e4c5b838..a3b45dfe2c8 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -1822,7 +1822,10 @@ int ctdb_start_revoke_ro_record(struct ctdb_context *ctdb, struct ctdb_db_contex
header->flags |= CTDB_REC_FLAG_MIGRATED_WITH_DATA;
header->rsn -= 1;
- if ((rev_hdl = talloc_zero(ctdb_db, struct revokechild_handle)) == NULL) {
+ rev_hdl = talloc_pooled_object(ctdb_db, struct revokechild_handle, 2,
+ data.dsize + key.dsize);
+
+ if (rev_hdl == NULL) {
DEBUG(DEBUG_ERR,("Failed to allocate revokechild_handle\n"));
return -1;
}
--
2.14.3
More information about the samba-technical
mailing list