[Devel] [PATCH vz9 v1 45/63] dm-ploop: give runner threads better name

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Jan 24 18:36:19 MSK 2025


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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 3fed26137831..56539406ce10 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -366,14 +366,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;
@@ -383,7 +384,6 @@ static struct ploop_worker *ploop_worker_create(struct ploop *ploop,
 	wake_up_process(task);
 
 	return worker;
-
 out_err:
 	kfree(worker);
 	return NULL;
-- 
2.43.0



More information about the Devel mailing list