[Devel] [RFC PATCH vz9 v6 51/62] dm-ploop: give runner threads better name

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Dec 6 00:56:24 MSK 2024


Encode device minor number into thread name.
If we use dm-ploop as prefix since name gets
truncated so shorten it to ploop.

https://virtuozzo.atlassian.net/browse/VSTOR-91821
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index d9f79da62315..8cf87bf982bd 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -373,14 +373,15 @@ static struct ploop_worker *ploop_worker_create(struct ploop *ploop,
 {
 	struct ploop_worker *worker;
 	struct task_struct *task;
+	int minor = MINOR(disk_devt(ploop->ti->table->md->disk));
 
 	worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT);
 	if (!worker)
 		return NULL;
 
 	worker->ploop = ploop;
-	task = kthread_create(worker_fn, worker, "ploop-%d-%s-%d",
-			current->pid, pref, id);
+	task = kthread_create(worker_fn, worker, "ploop%d-%s-%d",
+			minor, pref, id);
 
 	if (IS_ERR(task))
 		goto out_err;
@@ -388,15 +389,8 @@ static struct ploop_worker *ploop_worker_create(struct ploop *ploop,
 	init_llist_head(&worker->work_llist);
 
 	wake_up_process(task);
-	// TODO: handle cgroups
-	// ret = ploop_attach_cgroups(worker);
-	// if (ret)
-	//         goto stop_worker;
 
 	return worker;
-
-// stop_worker:
-//         kthread_stop(worker->task);
 out_err:
 	kfree(worker);
 	return NULL;
-- 
2.43.0



More information about the Devel mailing list