summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2017-07-18 11:36:19 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-07-19 14:16:19 +0000
commit33db9aff1deaa028f30516e49fdb1e8d6e31bb73 (patch)
tree36d88c93e1e83e4253b154199b0b12531d0edb39 /xlators/cluster/dht
parent5ccf0922208c368873120e235be0fd2975a589c1 (diff)
libglusterfs: Name threads on creation
Set names to threads on creation for easier debugging. Output of top -H -p <PID-OF-GLUSTERFSD> Before: 19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd After: 19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustertimer 19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustermemsweep 19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc0 19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc1 19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll0 19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteridxwrker 19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteriotwr0 19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrssign 19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrswrker 19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterclogecon 19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd0 19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd1 19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd2 19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixjan 19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixfsy 25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll1 5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll2 7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixhc Change-Id: Id5f333755c1ba168a2ffaa4fce6e71c375e10703 BUG: 1254002 Updates: #271 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: https://review.gluster.org/11926 Reviewed-by: Prashanth Pai <ppai@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c3
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c19
-rw-r--r--xlators/cluster/dht/src/tier.c20
3 files changed, 22 insertions, 20 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 6aa9b13e37a..253fd71068c 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -9290,7 +9290,8 @@ unlock:
run_defrag = 1;
ret = gf_thread_create(&conf->defrag->th,
NULL,
- gf_defrag_start, this);
+ gf_defrag_start, this,
+ "dhtdg");
if (ret) {
GF_FREE (conf->defrag);
conf->defrag = NULL;
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 2e80ada25a3..6a9153f794d 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -3988,8 +3988,9 @@ gf_tier_start_fix_layout (xlator_t *this,
/* Spawn the fix layout thread so that its done in the
* background */
- ret = pthread_create (&tier_fix_layout_arg->thread_id, NULL,
- gf_tier_do_fix_layout, tier_fix_layout_arg);
+ ret = gf_thread_create (&tier_fix_layout_arg->thread_id, NULL,
+ gf_tier_do_fix_layout,
+ tier_fix_layout_arg, "tierfixl");
if (ret) {
gf_log ("tier", GF_LOG_ERROR, "Thread creation failed. "
"Background fix layout for tiering will not "
@@ -4282,6 +4283,7 @@ gf_defrag_start_crawl (void *data)
int err = 0;
int thread_spawn_count = 0;
pthread_t *tid = NULL;
+ char thread_name[GF_THREAD_NAMEMAX] = {0,};
pthread_t filecnt_thread;
gf_boolean_t is_tier_detach = _gf_false;
call_frame_t *statfs_frame = NULL;
@@ -4447,9 +4449,9 @@ gf_defrag_start_crawl (void *data)
"time to complete rebalance.");
}
- ret = pthread_create (&filecnt_thread, NULL,
- &dht_file_counter_thread,
- (void *)defrag);
+ ret = gf_thread_create (&filecnt_thread, NULL,
+ &dht_file_counter_thread,
+ (void *)defrag, "dhtfcnt");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, ret, 0, "Failed to "
@@ -4491,8 +4493,11 @@ gf_defrag_start_crawl (void *data)
/*Spawn Threads Here*/
while (thread_index < thread_spawn_count) {
- err = pthread_create(&(tid[thread_index]), NULL,
- &gf_defrag_task, (void *)defrag);
+ snprintf (thread_name, sizeof(thread_name),
+ "%s%d", "dhtdf", thread_index + 1);
+ err = gf_thread_create (&(tid[thread_index]), NULL,
+ &gf_defrag_task, (void *)defrag,
+ thread_name);
if (err != 0) {
gf_log ("DHT", GF_LOG_ERROR,
"Thread[%d] creation failed. "
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index c8667228c59..db23b9661bb 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -2577,9 +2577,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
demotion_args.is_promotion = _gf_false;
demotion_args.is_compaction = _gf_false;
- ret = pthread_create (&demote_thread,
- NULL, &tier_run,
- &demotion_args);
+ ret = gf_thread_create (&demote_thread,
+ NULL, &tier_run, &demotion_args, "tierdem");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2596,9 +2595,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
promotion_args.defrag = defrag;
promotion_args.is_promotion = _gf_true;
- ret = pthread_create (&promote_thread,
- NULL, &tier_run,
- &promotion_args);
+ ret = gf_thread_create (&promote_thread, NULL, &tier_run,
+ &promotion_args, "tierpro");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2614,9 +2612,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
hot_compaction_args.is_compaction = _gf_true;
hot_compaction_args.is_hot_tier = _gf_true;
- ret = pthread_create (&hot_compact_thread,
- NULL, &tier_run,
- &hot_compaction_args);
+ ret = gf_thread_create (&hot_compact_thread, NULL, &tier_run,
+ &hot_compaction_args, "tierhcom");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2632,9 +2629,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
cold_compaction_args.is_compaction = _gf_true;
cold_compaction_args.is_hot_tier = _gf_false;
- ret = pthread_create (&cold_compact_thread,
- NULL, &tier_run,
- &cold_compaction_args);
+ ret = gf_thread_create (&cold_compact_thread, NULL, &tier_run,
+ &cold_compaction_args, "tierccom");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,