diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-06-29 14:07:51 -0400 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-07-05 12:27:30 +0000 |
commit | 7039243e187e1acc086812b038d4da71389dc507 (patch) | |
tree | b6827b1bc5a7cce565dbd7040baed3ce26cbe638 /api | |
parent | a14475fa835289f956af652b6b73ddaeffd4bf18 (diff) |
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 <jdarcy@fb.com>
Reviewed-on: https://review.gluster.org/17666
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Jeff Darcy <jeff@pl.atyp.us>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs.c | 12 |
1 files changed, 12 insertions, 0 deletions
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; |