summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-handleops.c
diff options
context:
space:
mode:
authorKinglong Mee <mijinlong@open-fs.com>2017-08-30 17:54:09 +0800
committerJeff Darcy <jeff@pl.atyp.us>2017-09-01 15:32:55 +0000
commitd7ccdb33c2e84bab25bf0898866104f8a85b4217 (patch)
tree451568625f26dc732e52c318f414e777c8b2e19a /api/src/glfs-handleops.c
parent75223c0a1b3c7bd65bb0c59449ed1fb0663cfdd3 (diff)
gfapi: adds a glfs_mem_header for exported memory
glfs_free releases different types of data depends on memory type. Drop the depends of memory type of memory accounting, new macro GLFS_CALLOC/GLFS_MALLOC/GLFS_REALLOC/GLFS_FREE are added to support assign release function dynamically, it adds a separate memory header named glfs_mem_header for gfapi. Updates: #312 Change-Id: Ie608e5227cbaa05d3f4681a515e83a50d5b17c3f Signed-off-by: Kinglong Mee <mijinlong@open-fs.com> Reviewed-on: https://review.gluster.org/18092 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'api/src/glfs-handleops.c')
-rw-r--r--api/src/glfs-handleops.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c
index 4180f5cf777..65b2b6a467c 100644
--- a/api/src/glfs-handleops.c
+++ b/api/src/glfs-handleops.c
@@ -1987,6 +1987,14 @@ out:
return ret;
}
+static void glfs_release_upcall (void *ptr)
+{
+ struct glfs_upcall *to_free = ptr;
+
+ if (to_free->event)
+ to_free->free_event (to_free->event);
+}
+
/*
* This API is used to poll for upcall events stored in the upcall list.
* Current users of this API is NFS-Ganesha. Incase of any event received, it
@@ -2068,8 +2076,9 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct glfs_upcall **up_arg)
if (upcall_data) {
switch (upcall_data->event_type) {
case GF_UPCALL_CACHE_INVALIDATION:
- *up_arg = GF_CALLOC (1, sizeof (struct gf_upcall),
- glfs_mt_upcall_entry_t);
+ *up_arg = GLFS_CALLOC (1, sizeof (struct gf_upcall),
+ glfs_release_upcall,
+ glfs_mt_upcall_entry_t);
if (!*up_arg) {
errno = ENOMEM;
break; /* goto free u_list */
@@ -2088,7 +2097,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct glfs_upcall **up_arg)
if ((*up_arg)->reason == GLFS_UPCALL_EVENT_NULL)
errno = ENOENT;
- GF_FREE (*up_arg);
+ GLFS_FREE (*up_arg);
*up_arg = NULL;
}
break;