From 33db9aff1deaa028f30516e49fdb1e8d6e31bb73 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Tue, 18 Jul 2017 11:36:19 +0530 Subject: libglusterfs: Name threads on creation Set names to threads on creation for easier debugging. Output of top -H -p 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 Reviewed-on: https://review.gluster.org/11926 Reviewed-by: Prashanth Pai Smoke: Gluster Build System Reviewed-by: Niels de Vos CentOS-regression: Gluster Build System --- xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 6 ++++-- xlators/features/bit-rot/src/bitd/bit-rot.c | 11 +++++++---- xlators/features/bit-rot/src/stub/bit-rot-stub.c | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'xlators/features/bit-rot/src') diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index e043ef84a52..8812e99535a 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -1299,7 +1299,8 @@ br_scrubber_scale_up (xlator_t *this, INIT_LIST_HEAD (&scrub->list); ret = gf_thread_create (&scrub->scrubthread, - NULL, br_scrubber_proc, fsscrub); + NULL, br_scrubber_proc, fsscrub, + "brsproc"); if (ret) break; @@ -1976,7 +1977,8 @@ br_scrubber_monitor_init (xlator_t *this, br_private_t *priv) br_set_scrub_state (&priv->scrub_monitor, BR_SCRUB_STATE_INACTIVE); /* Start the monitor thread */ - ret = gf_thread_create (&scrub_monitor->thread, NULL, br_monitor_thread, this); + ret = gf_thread_create (&scrub_monitor->thread, NULL, + br_monitor_thread, this, "brmon"); if (ret != 0) { gf_msg (this->name, GF_LOG_ERROR, -ret, BRB_MSG_SPAWN_FAILED, "monitor thread creation failed"); diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index c591db53ad4..3c42cb2a1f6 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1133,7 +1133,8 @@ br_enact_signer (xlator_t *this, br_child_t *child, br_stub_init_t *stub) } child->threadrunning = 0; - ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child); + ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child, + "brosign"); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SPAWN_FAILED, "failed to spawn FS crawler thread"); @@ -1161,7 +1162,8 @@ br_launch_scrubber (xlator_t *this, br_child_t *child, priv = this->private; scrub_monitor = &priv->scrub_monitor; - ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child); + ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child, + "brfsscan"); if (ret != 0) { gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_SPAWN_FAILED, "failed to spawn bitrot scrubber daemon [Brick: %s]", @@ -1750,7 +1752,7 @@ br_init_signer (xlator_t *this, br_private_t *priv) for (i = 0; i < BR_WORKERS; i++) { ret = gf_thread_create (&priv->obj_queue->workers[i], NULL, - br_process_object, this); + br_process_object, this, "brpobj"); if (ret != 0) { gf_msg (this->name, GF_LOG_ERROR, -ret, BRB_MSG_SPAWN_FAILED, "thread creation" @@ -2021,7 +2023,8 @@ init (xlator_t *this) if (ret) goto cleanup; - ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this); + ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this, + "brhevent"); if (ret != 0) { gf_msg (this->name, GF_LOG_ERROR, -ret, BRB_MSG_SPAWN_FAILED, "thread creation failed"); diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c index b8a34422522..fb187a3a93a 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c @@ -97,7 +97,8 @@ br_stub_bad_object_container_init (xlator_t *this, br_stub_private_t *priv) if (ret < 0) goto cleanup_lock; - ret = gf_thread_create (&priv->container.thread, &w_attr, br_stub_worker, this); + ret = gf_thread_create (&priv->container.thread, &w_attr, + br_stub_worker, this, "brswrker"); if (ret) goto cleanup_attr; @@ -158,7 +159,8 @@ init (xlator_t *this) */ this->private = priv; - ret = gf_thread_create (&priv->signth, NULL, br_stub_signth, this); + ret = gf_thread_create (&priv->signth, NULL, br_stub_signth, this, + "brssign"); if (ret != 0) goto cleanup_lock; -- cgit