Skip to content

Commit f635237

Browse files
caihuoqing1990snitm
authored andcommitted
dm writecache: Make use of the helper macro kthread_run()
Replace kthread_create/wake_up_process() with kthread_run() to simplify the code. Signed-off-by: Cai Huoqing <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent a5217c1 commit f635237

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/md/dm-writecache.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,14 +2264,13 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
22642264

22652265
raw_spin_lock_init(&wc->endio_list_lock);
22662266
INIT_LIST_HEAD(&wc->endio_list);
2267-
wc->endio_thread = kthread_create(writecache_endio_thread, wc, "writecache_endio");
2267+
wc->endio_thread = kthread_run(writecache_endio_thread, wc, "writecache_endio");
22682268
if (IS_ERR(wc->endio_thread)) {
22692269
r = PTR_ERR(wc->endio_thread);
22702270
wc->endio_thread = NULL;
22712271
ti->error = "Couldn't spawn endio thread";
22722272
goto bad;
22732273
}
2274-
wake_up_process(wc->endio_thread);
22752274

22762275
/*
22772276
* Parse the mode (pmem or ssd)
@@ -2493,14 +2492,13 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
24932492
wc->memory_map_size -= (uint64_t)wc->start_sector << SECTOR_SHIFT;
24942493

24952494
bio_list_init(&wc->flush_list);
2496-
wc->flush_thread = kthread_create(writecache_flush_thread, wc, "dm_writecache_flush");
2495+
wc->flush_thread = kthread_run(writecache_flush_thread, wc, "dm_writecache_flush");
24972496
if (IS_ERR(wc->flush_thread)) {
24982497
r = PTR_ERR(wc->flush_thread);
24992498
wc->flush_thread = NULL;
25002499
ti->error = "Couldn't spawn flush thread";
25012500
goto bad;
25022501
}
2503-
wake_up_process(wc->flush_thread);
25042502

25052503
r = calculate_memory_size(wc->memory_map_size, wc->block_size,
25062504
&n_blocks, &n_metadata_blocks);

0 commit comments

Comments
 (0)