diff options
author | Matthew Sakai <msakai@redhat.com> | 2024-03-01 18:29:05 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2024-03-04 23:11:11 -0500 |
commit | 7eb30fe18fe9eae235f71ecd5c1d24eaeb21a036 (patch) | |
tree | 9cdbde9f5355a298bd707975d6d6f020f999968f /drivers/md/dm-vdo/thread-utils.c | |
parent | d0464d8287364bc754790128fbe95e38837c760b (diff) | |
download | lwn-7eb30fe18fe9eae235f71ecd5c1d24eaeb21a036.tar.gz lwn-7eb30fe18fe9eae235f71ecd5c1d24eaeb21a036.zip |
dm vdo: remove vdo_perform_once
Remove obsolete function vdo_perform_once. Instead, initialize
necessary module state when loading the module.
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-vdo/thread-utils.c')
-rw-r--r-- | drivers/md/dm-vdo/thread-utils.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/md/dm-vdo/thread-utils.c b/drivers/md/dm-vdo/thread-utils.c index bd620be61c1d..ec08478dd013 100644 --- a/drivers/md/dm-vdo/thread-utils.c +++ b/drivers/md/dm-vdo/thread-utils.c @@ -17,7 +17,6 @@ static struct hlist_head thread_list; static struct mutex thread_mutex; -static atomic_t thread_once = ATOMIC_INIT(0); struct thread { void (*thread_function)(void *thread_data); @@ -27,31 +26,7 @@ struct thread { struct completion thread_done; }; -#define ONCE_NOT_DONE 0 -#define ONCE_IN_PROGRESS 1 -#define ONCE_COMPLETE 2 - -/* Run a function once only, and record that fact in the atomic value. */ -void vdo_perform_once(atomic_t *once, void (*function)(void)) -{ - for (;;) { - switch (atomic_cmpxchg(once, ONCE_NOT_DONE, ONCE_IN_PROGRESS)) { - case ONCE_NOT_DONE: - function(); - atomic_set_release(once, ONCE_COMPLETE); - return; - case ONCE_IN_PROGRESS: - cond_resched(); - break; - case ONCE_COMPLETE: - return; - default: - return; - } - } -} - -static void thread_init(void) +void vdo_initialize_threads_mutex(void) { mutex_init(&thread_mutex); } @@ -62,7 +37,6 @@ static int thread_starter(void *arg) struct thread *thread = arg; thread->thread_task = current; - vdo_perform_once(&thread_once, thread_init); mutex_lock(&thread_mutex); hlist_add_head(&thread->thread_links, &thread_list); mutex_unlock(&thread_mutex); |