Commit 0da3c619 authored by NeilBrown's avatar NeilBrown

md: Improve name of threads created by md_register_thread

The management thread for raid4,5,6 arrays are all called
mdX_raid5, independent of the actual raid level, which is wrong and
can be confusion.

So change md_register_thread to use the name from the personality
unless no alternate name (like 'resync' or 'reshape') is given.

This is simpler and more correct.

Cc: Jinzc <zhenchengjin@gmail.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent ee305ace
...@@ -4218,7 +4218,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -4218,7 +4218,7 @@ static int do_md_run(mddev_t * mddev)
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
mddev->sync_thread = md_register_thread(md_do_sync, mddev->sync_thread = md_register_thread(md_do_sync,
mddev, mddev,
"%s_resync"); "resync");
if (!mddev->sync_thread) { if (!mddev->sync_thread) {
printk(KERN_ERR "%s: could not start resync" printk(KERN_ERR "%s: could not start resync"
" thread...\n", " thread...\n",
...@@ -5631,7 +5631,10 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, ...@@ -5631,7 +5631,10 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
thread->run = run; thread->run = run;
thread->mddev = mddev; thread->mddev = mddev;
thread->timeout = MAX_SCHEDULE_TIMEOUT; thread->timeout = MAX_SCHEDULE_TIMEOUT;
thread->tsk = kthread_run(md_thread, thread, name, mdname(thread->mddev)); thread->tsk = kthread_run(md_thread, thread,
"%s_%s",
mdname(thread->mddev),
name ?: mddev->pers->name);
if (IS_ERR(thread->tsk)) { if (IS_ERR(thread->tsk)) {
kfree(thread); kfree(thread);
return NULL; return NULL;
...@@ -6745,7 +6748,7 @@ void md_check_recovery(mddev_t *mddev) ...@@ -6745,7 +6748,7 @@ void md_check_recovery(mddev_t *mddev)
} }
mddev->sync_thread = md_register_thread(md_do_sync, mddev->sync_thread = md_register_thread(md_do_sync,
mddev, mddev,
"%s_resync"); "resync");
if (!mddev->sync_thread) { if (!mddev->sync_thread) {
printk(KERN_ERR "%s: could not start resync" printk(KERN_ERR "%s: could not start resync"
" thread...\n", " thread...\n",
......
...@@ -504,7 +504,7 @@ static int multipath_run (mddev_t *mddev) ...@@ -504,7 +504,7 @@ static int multipath_run (mddev_t *mddev)
} }
{ {
mddev->thread = md_register_thread(multipathd, mddev, "%s_multipath"); mddev->thread = md_register_thread(multipathd, mddev, NULL);
if (!mddev->thread) { if (!mddev->thread) {
printk(KERN_ERR "multipath: couldn't allocate thread" printk(KERN_ERR "multipath: couldn't allocate thread"
" for %s\n", mdname(mddev)); " for %s\n", mdname(mddev));
......
...@@ -2047,7 +2047,7 @@ static int run(mddev_t *mddev) ...@@ -2047,7 +2047,7 @@ static int run(mddev_t *mddev)
conf->last_used = j; conf->last_used = j;
mddev->thread = md_register_thread(raid1d, mddev, "%s_raid1"); mddev->thread = md_register_thread(raid1d, mddev, NULL);
if (!mddev->thread) { if (!mddev->thread) {
printk(KERN_ERR printk(KERN_ERR
"raid1: couldn't allocate thread for %s\n", "raid1: couldn't allocate thread for %s\n",
......
...@@ -2188,7 +2188,7 @@ static int run(mddev_t *mddev) ...@@ -2188,7 +2188,7 @@ static int run(mddev_t *mddev)
} }
mddev->thread = md_register_thread(raid10d, mddev, "%s_raid10"); mddev->thread = md_register_thread(raid10d, mddev, NULL);
if (!mddev->thread) { if (!mddev->thread) {
printk(KERN_ERR printk(KERN_ERR
"raid10: couldn't allocate thread for %s\n", "raid10: couldn't allocate thread for %s\n",
......
...@@ -4448,7 +4448,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) ...@@ -4448,7 +4448,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
printk(KERN_INFO "raid5: allocated %dkB for %s\n", printk(KERN_INFO "raid5: allocated %dkB for %s\n",
memory, mdname(mddev)); memory, mdname(mddev));
conf->thread = md_register_thread(raid5d, mddev, "%s_raid5"); conf->thread = md_register_thread(raid5d, mddev, NULL);
if (!conf->thread) { if (!conf->thread) {
printk(KERN_ERR printk(KERN_ERR
"raid5: couldn't allocate thread for %s\n", "raid5: couldn't allocate thread for %s\n",
...@@ -4614,7 +4614,7 @@ static int run(mddev_t *mddev) ...@@ -4614,7 +4614,7 @@ static int run(mddev_t *mddev)
set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
mddev->sync_thread = md_register_thread(md_do_sync, mddev, mddev->sync_thread = md_register_thread(md_do_sync, mddev,
"%s_reshape"); "reshape");
} }
/* read-ahead size must cover two whole stripes, which is /* read-ahead size must cover two whole stripes, which is
...@@ -5032,7 +5032,7 @@ static int raid5_start_reshape(mddev_t *mddev) ...@@ -5032,7 +5032,7 @@ static int raid5_start_reshape(mddev_t *mddev)
set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
mddev->sync_thread = md_register_thread(md_do_sync, mddev, mddev->sync_thread = md_register_thread(md_do_sync, mddev,
"%s_reshape"); "reshape");
if (!mddev->sync_thread) { if (!mddev->sync_thread) {
mddev->recovery = 0; mddev->recovery = 0;
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment