mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
md: use separate work_struct for md_start_sync()
It's a little weird to borrow 'del_work' for md_start_sync(), declare a new work_struct 'sync_work' for md_start_sync(). Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Xiao Ni <xni@redhat.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230825031622.1530464-2-yukuai1@huaweicloud.com
This commit is contained in:
parent
d78bfa1346
commit
ac61978196
@ -631,13 +631,13 @@ void mddev_put(struct mddev *mddev)
|
||||
* flush_workqueue() after mddev_find will succeed in waiting
|
||||
* for the work to be done.
|
||||
*/
|
||||
INIT_WORK(&mddev->del_work, mddev_delayed_delete);
|
||||
queue_work(md_misc_wq, &mddev->del_work);
|
||||
}
|
||||
spin_unlock(&all_mddevs_lock);
|
||||
}
|
||||
|
||||
static void md_safemode_timeout(struct timer_list *t);
|
||||
static void md_start_sync(struct work_struct *ws);
|
||||
|
||||
void mddev_init(struct mddev *mddev)
|
||||
{
|
||||
@ -662,6 +662,9 @@ void mddev_init(struct mddev *mddev)
|
||||
mddev->resync_min = 0;
|
||||
mddev->resync_max = MaxSector;
|
||||
mddev->level = LEVEL_NONE;
|
||||
|
||||
INIT_WORK(&mddev->sync_work, md_start_sync);
|
||||
INIT_WORK(&mddev->del_work, mddev_delayed_delete);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mddev_init);
|
||||
|
||||
@ -9256,7 +9259,7 @@ no_add:
|
||||
|
||||
static void md_start_sync(struct work_struct *ws)
|
||||
{
|
||||
struct mddev *mddev = container_of(ws, struct mddev, del_work);
|
||||
struct mddev *mddev = container_of(ws, struct mddev, sync_work);
|
||||
|
||||
rcu_assign_pointer(mddev->sync_thread,
|
||||
md_register_thread(md_do_sync, mddev, "resync"));
|
||||
@ -9469,8 +9472,7 @@ void md_check_recovery(struct mddev *mddev)
|
||||
*/
|
||||
md_bitmap_write_all(mddev->bitmap);
|
||||
}
|
||||
INIT_WORK(&mddev->del_work, md_start_sync);
|
||||
queue_work(md_misc_wq, &mddev->del_work);
|
||||
queue_work(md_misc_wq, &mddev->sync_work);
|
||||
goto unlock;
|
||||
}
|
||||
not_running:
|
||||
|
@ -453,7 +453,10 @@ struct mddev {
|
||||
struct kernfs_node *sysfs_degraded; /*handle for 'degraded' */
|
||||
struct kernfs_node *sysfs_level; /*handle for 'level' */
|
||||
|
||||
struct work_struct del_work; /* used for delayed sysfs removal */
|
||||
/* used for delayed sysfs removal */
|
||||
struct work_struct del_work;
|
||||
/* used for register new sync thread */
|
||||
struct work_struct sync_work;
|
||||
|
||||
/* "lock" protects:
|
||||
* flush_bio transition from NULL to !NULL
|
||||
|
Loading…
Reference in New Issue
Block a user