summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/glusterfs
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2019-03-05 18:58:20 +0100
committerhari gowtham <hari.gowtham005@gmail.com>2019-07-03 06:25:48 +0000
commit6697af343dfbe135735a035cbf592b94750bd589 (patch)
treea8da7bec25c23c135bbd4d06be1257692a8d50e1 /libglusterfs/src/glusterfs
parentb7b76714691d464b09a6363ccc2783080cb17ea2 (diff)
core: avoid dynamic TLS allocation when possible
Some interdependencies between logging and memory management functions make it impossible to use the logging framework before initializing memory subsystem because they both depend on Thread Local Storage allocated through pthread_key_create() during initialization. This causes a crash when we try to log something very early in the initialization phase. To prevent this, several dynamically allocated TLS structures have been replaced by static TLS reserved at compile time using '__thread' keyword. This also reduces the number of error sources, making initialization simpler. Backport of: > BUG: 1193929 > Change-Id: I8ea2e072411e30790d50084b6b7e909c7bb01d50 > Signed-off-by: Xavi Hernandez <xhernandez@redhat.com> Updates: bz#1724210 Change-Id: I8ea2e072411e30790d50084b6b7e909c7bb01d50 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'libglusterfs/src/glusterfs')
-rw-r--r--libglusterfs/src/glusterfs/globals.h6
-rw-r--r--libglusterfs/src/glusterfs/mem-pool.h7
2 files changed, 6 insertions, 7 deletions
diff --git a/libglusterfs/src/glusterfs/globals.h b/libglusterfs/src/glusterfs/globals.h
index 8d898c3abf4..994301bd862 100644
--- a/libglusterfs/src/glusterfs/globals.h
+++ b/libglusterfs/src/glusterfs/globals.h
@@ -128,7 +128,7 @@ xlator_t **
__glusterfs_this_location(void);
xlator_t *
glusterfs_this_get(void);
-int
+void
glusterfs_this_set(xlator_t *);
extern xlator_t global_xlator;
@@ -137,13 +137,11 @@ extern struct volume_options global_xl_options[];
/* syncopctx */
void *
syncopctx_getctx(void);
-int
-syncopctx_setctx(void *ctx);
/* task */
void *
synctask_get(void);
-int
+void
synctask_set(void *);
/* uuid_buf */
diff --git a/libglusterfs/src/glusterfs/mem-pool.h b/libglusterfs/src/glusterfs/mem-pool.h
index 0250b590fd9..c5a486b4cc8 100644
--- a/libglusterfs/src/glusterfs/mem-pool.h
+++ b/libglusterfs/src/glusterfs/mem-pool.h
@@ -279,9 +279,7 @@ struct mem_pool_shared {
};
void
-mem_pools_init_early(void); /* basic initialization of memory pools */
-void
-mem_pools_init_late(void); /* start the pool_sweeper thread */
+mem_pools_init(void); /* start the pool_sweeper thread */
void
mem_pools_fini(void); /* cleanup memory pools */
@@ -306,6 +304,9 @@ void
mem_pool_destroy(struct mem_pool *pool);
void
+mem_pool_thread_destructor(void);
+
+void
gf_mem_acct_enable_set(void *ctx);
#endif /* _MEM_POOL_H */