From 7039243e187e1acc086812b038d4da71389dc507 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Thu, 29 Jun 2017 14:07:51 -0400 Subject: gfapi: add mem_pools_init and mem_pools_fini calls These are both needed because GFAPI clients are a bit unique. They can be long-running, so they can potentially benefit from the memory reclamation that mem_pools_init will enable. On the other hand, they might completely tear down their Gluster environment well before the process exits, so they need mem_pools_fini as well. Our main and auxiliary daemons do need mem_pools_init but don't need to call it themselves because that's handled for them in glusterfsd.c right after they daemonize. They don't need mem_pools_fini, because the only place they could *safely* call it is right before exit and then it won't do them any good. Transient processes (e.g. gf_attach) don't benefit from either because, well, they're transient. They'll be gone before memory reclamation matters. Change-Id: I611cf77d8b408b3ecfc00664e8da294edde9e57a Signed-off-by: Jeff Darcy Reviewed-on: https://review.gluster.org/17666 Smoke: Gluster Build System Tested-by: Jeff Darcy CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- api/src/glfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'api') diff --git a/api/src/glfs.c b/api/src/glfs.c index d9f07603b0f..5c77a63d101 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -1026,6 +1026,12 @@ pub_glfs_init (struct glfs *fs) return ret; } + /* + * Do this as soon as possible in case something else depends on + * pool allocations. + */ + mem_pools_init (); + __GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs); ret = glfs_init_common (fs); @@ -1278,6 +1284,12 @@ pub_glfs_fini (struct glfs *fs) free_fs: glfs_free_from_ctx (fs); + /* + * Do this as late as possible in case anything else has (or + * grows) a dependency on mem-pool allocations. + */ + mem_pools_fini (); + fail: if (!ret) ret = err; -- cgit