From 4674678951a1315975d66016fb55c49100b7819f Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Thu, 24 Jan 2019 18:31:10 +0100 Subject: core: make gf_thread_create() easier to use This patch creates a specific function to set the thread name using a string format and a variable argument list, like printf(). This function is used to set the thread name from gf_thread_create(), which now accepts a variable argument list to create the full name. It's not necessary anymore to use a local array to build the name of the thread. This is done automatically. Change-Id: Idd8d01fd462c227359b96e98699f8c6d962dc17c Updates: bz#1193929 Signed-off-by: Xavi Hernandez --- xlators/cluster/dht/src/dht-rebalance.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'xlators/cluster/dht') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 46acc77c4b0..e0f25b1d080 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -4436,9 +4436,6 @@ gf_defrag_parallel_migration_init(xlator_t *this, gf_defrag_info_t *defrag, int thread_spawn_count = 0; int index = 0; pthread_t *tid = NULL; - char thread_name[GF_THREAD_NAMEMAX] = { - 0, - }; if (!defrag) goto out; @@ -4472,10 +4469,8 @@ gf_defrag_parallel_migration_init(xlator_t *this, gf_defrag_info_t *defrag, /*Spawn Threads Here*/ while (index < thread_spawn_count) { - snprintf(thread_name, sizeof(thread_name), "dhtmig%d", - ((index + 1) & 0x3ff)); ret = gf_thread_create(&(tid[index]), NULL, &gf_defrag_task, - (void *)defrag, thread_name); + (void *)defrag, "dhtmig%d", (index + 1) & 0x3ff); if (ret != 0) { gf_msg("DHT", GF_LOG_ERROR, ret, 0, "Thread[%d] creation failed. ", index); -- cgit