Commit 82b354ff authored by Mike Snitzer's avatar Mike Snitzer

dm vdo thread-registry: rename all methods to reflect vdo-only use

Otherwise, uds_ prefix is misleading (vdo_ is the new catch-all for
code that is used by vdo-only or _both_ vdo and the indexer code).
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent cb6f8b75
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
/* /*
* UDS and VDO keep track of which threads are allowed to allocate memory freely, and which threads * UDS and VDO keep track of which threads are allowed to allocate memory freely, and which threads
* must be careful to not do a memory allocation that does an I/O request. The allocating_threads * must be careful to not do a memory allocation that does an I/O request. The 'allocating_threads'
* threads_registry and its associated methods implement this tracking. * thread_registry and its associated methods implement this tracking.
*/ */
static struct thread_registry allocating_threads; static struct thread_registry allocating_threads;
static bool allocations_allowed(void) static bool allocations_allowed(void)
{ {
const bool *pointer = uds_lookup_thread(&allocating_threads); const bool *pointer = vdo_lookup_thread(&allocating_threads);
return (pointer != NULL) ? *pointer : false; return (pointer != NULL) ? *pointer : false;
} }
...@@ -48,13 +48,13 @@ void uds_register_allocating_thread(struct registered_thread *new_thread, ...@@ -48,13 +48,13 @@ void uds_register_allocating_thread(struct registered_thread *new_thread,
flag_ptr = &allocation_always_allowed; flag_ptr = &allocation_always_allowed;
} }
uds_register_thread(&allocating_threads, new_thread, flag_ptr); vdo_register_thread(&allocating_threads, new_thread, flag_ptr);
} }
/* Unregister the current thread as an allocating thread. */ /* Unregister the current thread as an allocating thread. */
void uds_unregister_allocating_thread(void) void uds_unregister_allocating_thread(void)
{ {
uds_unregister_thread(&allocating_threads); vdo_unregister_thread(&allocating_threads);
} }
/* /*
...@@ -384,7 +384,7 @@ int uds_duplicate_string(const char *string, const char *what, char **new_string ...@@ -384,7 +384,7 @@ int uds_duplicate_string(const char *string, const char *what, char **new_string
void uds_memory_init(void) void uds_memory_init(void)
{ {
spin_lock_init(&memory_stats.lock); spin_lock_init(&memory_stats.lock);
uds_initialize_thread_registry(&allocating_threads); vdo_initialize_thread_registry(&allocating_threads);
} }
void uds_memory_exit(void) void uds_memory_exit(void)
......
...@@ -14,23 +14,23 @@ static struct thread_registry device_id_thread_registry; ...@@ -14,23 +14,23 @@ static struct thread_registry device_id_thread_registry;
void uds_register_thread_device_id(struct registered_thread *new_thread, void uds_register_thread_device_id(struct registered_thread *new_thread,
unsigned int *id_ptr) unsigned int *id_ptr)
{ {
uds_register_thread(&device_id_thread_registry, new_thread, id_ptr); vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr);
} }
void uds_unregister_thread_device_id(void) void uds_unregister_thread_device_id(void)
{ {
uds_unregister_thread(&device_id_thread_registry); vdo_unregister_thread(&device_id_thread_registry);
} }
int uds_get_thread_device_id(void) int uds_get_thread_device_id(void)
{ {
const unsigned int *pointer; const unsigned int *pointer;
pointer = uds_lookup_thread(&device_id_thread_registry); pointer = vdo_lookup_thread(&device_id_thread_registry);
return (pointer != NULL) ? *pointer : -1; return (pointer != NULL) ? *pointer : -1;
} }
void uds_initialize_thread_device_registry(void) void uds_initialize_thread_device_registry(void)
{ {
uds_initialize_thread_registry(&device_id_thread_registry); vdo_initialize_thread_registry(&device_id_thread_registry);
} }
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
* their normal operation. For example, we do not want to invoke the logger while holding a lock. * their normal operation. For example, we do not want to invoke the logger while holding a lock.
*/ */
void uds_initialize_thread_registry(struct thread_registry *registry) void vdo_initialize_thread_registry(struct thread_registry *registry)
{ {
INIT_LIST_HEAD(&registry->links); INIT_LIST_HEAD(&registry->links);
spin_lock_init(&registry->lock); spin_lock_init(&registry->lock);
} }
/* Register the current thread and associate it with a data pointer. */ /* Register the current thread and associate it with a data pointer. */
void uds_register_thread(struct thread_registry *registry, void vdo_register_thread(struct thread_registry *registry,
struct registered_thread *new_thread, const void *pointer) struct registered_thread *new_thread, const void *pointer)
{ {
struct registered_thread *thread; struct registered_thread *thread;
...@@ -51,7 +51,7 @@ void uds_register_thread(struct thread_registry *registry, ...@@ -51,7 +51,7 @@ void uds_register_thread(struct thread_registry *registry,
} }
} }
void uds_unregister_thread(struct thread_registry *registry) void vdo_unregister_thread(struct thread_registry *registry)
{ {
struct registered_thread *thread; struct registered_thread *thread;
bool found_it = false; bool found_it = false;
...@@ -74,7 +74,7 @@ void uds_unregister_thread(struct thread_registry *registry) ...@@ -74,7 +74,7 @@ void uds_unregister_thread(struct thread_registry *registry)
} }
} }
const void *uds_lookup_thread(struct thread_registry *registry) const void *vdo_lookup_thread(struct thread_registry *registry)
{ {
struct registered_thread *thread; struct registered_thread *thread;
const void *result = NULL; const void *result = NULL;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* Copyright 2023 Red Hat * Copyright 2023 Red Hat
*/ */
#ifndef UDS_THREAD_REGISTRY_H #ifndef VDO_THREAD_REGISTRY_H
#define UDS_THREAD_REGISTRY_H #define VDO_THREAD_REGISTRY_H
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -20,13 +20,13 @@ struct registered_thread { ...@@ -20,13 +20,13 @@ struct registered_thread {
struct task_struct *task; struct task_struct *task;
}; };
void uds_initialize_thread_registry(struct thread_registry *registry); void vdo_initialize_thread_registry(struct thread_registry *registry);
void uds_register_thread(struct thread_registry *registry, void vdo_register_thread(struct thread_registry *registry,
struct registered_thread *new_thread, const void *pointer); struct registered_thread *new_thread, const void *pointer);
void uds_unregister_thread(struct thread_registry *registry); void vdo_unregister_thread(struct thread_registry *registry);
const void *uds_lookup_thread(struct thread_registry *registry); const void *vdo_lookup_thread(struct thread_registry *registry);
#endif /* UDS_THREAD_REGISTRY_H */ #endif /* VDO_THREAD_REGISTRY_H */
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