[PATCH 13/13] dm vdo thread-device: rename all methods to reflect vdo-only use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mike Snitzer <snitzer@xxxxxxxxxx>

Also moved vdo_init()'s call to vdo_initialize_thread_device_registry
next to other registry initialization.

Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx>
Signed-off-by: Matthew Sakai <msakai@xxxxxxxxxx>
---
 drivers/md/dm-vdo/dm-vdo-target.c | 30 +++++++++++++++---------------
 drivers/md/dm-vdo/logger.c        |  2 +-
 drivers/md/dm-vdo/thread-device.c | 10 ++++------
 drivers/md/dm-vdo/thread-device.h | 14 +++++++-------
 4 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/drivers/md/dm-vdo/dm-vdo-target.c b/drivers/md/dm-vdo/dm-vdo-target.c
index e754b9e30cab..7afd1dfec649 100644
--- a/drivers/md/dm-vdo/dm-vdo-target.c
+++ b/drivers/md/dm-vdo/dm-vdo-target.c
@@ -1107,7 +1107,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv,
 
 	vdo = get_vdo_for_target(ti);
 	uds_register_allocating_thread(&allocating_thread, NULL);
-	uds_register_thread_device_id(&instance_thread, &vdo->instance);
+	vdo_register_thread_device_id(&instance_thread, &vdo->instance);
 
 	/*
 	 * Must be done here so we don't map return codes. The code in dm-ioctl expects a 1 for a
@@ -1120,7 +1120,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv,
 		result = vdo_status_to_errno(process_vdo_message(vdo, argc, argv));
 	}
 
-	uds_unregister_thread_device_id();
+	vdo_unregister_thread_device_id();
 	uds_unregister_allocating_thread();
 	return result;
 }
@@ -1632,9 +1632,9 @@ static int construct_new_vdo(struct dm_target *ti, unsigned int argc, char **arg
 	if (result != VDO_SUCCESS)
 		return -ENOMEM;
 
-	uds_register_thread_device_id(&instance_thread, &instance);
+	vdo_register_thread_device_id(&instance_thread, &instance);
 	result = construct_new_vdo_registered(ti, argc, argv, instance);
-	uds_unregister_thread_device_id();
+	vdo_unregister_thread_device_id();
 	return result;
 }
 
@@ -1913,9 +1913,9 @@ static int vdo_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	if (vdo == NULL) {
 		result = construct_new_vdo(ti, argc, argv);
 	} else {
-		uds_register_thread_device_id(&instance_thread, &vdo->instance);
+		vdo_register_thread_device_id(&instance_thread, &vdo->instance);
 		result = update_existing_vdo(device_name, ti, argc, argv, vdo);
-		uds_unregister_thread_device_id();
+		vdo_unregister_thread_device_id();
 	}
 
 	uds_unregister_allocating_thread();
@@ -1935,7 +1935,7 @@ static void vdo_dtr(struct dm_target *ti)
 		unsigned int instance = vdo->instance;
 		struct registered_thread allocating_thread, instance_thread;
 
-		uds_register_thread_device_id(&instance_thread, &instance);
+		vdo_register_thread_device_id(&instance_thread, &instance);
 		uds_register_allocating_thread(&allocating_thread, NULL);
 
 		device_name = vdo_get_device_name(ti);
@@ -1945,7 +1945,7 @@ static void vdo_dtr(struct dm_target *ti)
 
 		vdo_destroy(uds_forget(vdo));
 		uds_log_info("device '%s' stopped", device_name);
-		uds_unregister_thread_device_id();
+		vdo_unregister_thread_device_id();
 		uds_unregister_allocating_thread();
 		release_instance(instance);
 	} else if (config == vdo->device_config) {
@@ -2104,7 +2104,7 @@ static void vdo_postsuspend(struct dm_target *ti)
 	const char *device_name;
 	int result;
 
-	uds_register_thread_device_id(&instance_thread, &vdo->instance);
+	vdo_register_thread_device_id(&instance_thread, &vdo->instance);
 	device_name = vdo_get_device_name(vdo->device_config->owning_target);
 	uds_log_info("suspending device '%s'", device_name);
 
@@ -2129,7 +2129,7 @@ static void vdo_postsuspend(struct dm_target *ti)
 				       device_name);
 	}
 
-	uds_unregister_thread_device_id();
+	vdo_unregister_thread_device_id();
 }
 
 /**
@@ -2846,11 +2846,11 @@ static int vdo_preresume(struct dm_target *ti)
 	struct vdo *vdo = get_vdo_for_target(ti);
 	int result;
 
-	uds_register_thread_device_id(&instance_thread, &vdo->instance);
+	vdo_register_thread_device_id(&instance_thread, &vdo->instance);
 	result = vdo_preresume_registered(ti, vdo);
 	if ((result == VDO_PARAMETER_MISMATCH) || (result == VDO_INVALID_ADMIN_STATE))
 		result = -EINVAL;
-	uds_unregister_thread_device_id();
+	vdo_unregister_thread_device_id();
 	return vdo_status_to_errno(result);
 }
 
@@ -2858,10 +2858,10 @@ static void vdo_resume(struct dm_target *ti)
 {
 	struct registered_thread instance_thread;
 
-	uds_register_thread_device_id(&instance_thread,
+	vdo_register_thread_device_id(&instance_thread,
 				      &get_vdo_for_target(ti)->instance);
 	uds_log_info("device '%s' resumed", vdo_get_device_name(ti));
-	uds_unregister_thread_device_id();
+	vdo_unregister_thread_device_id();
 }
 
 /*
@@ -2912,10 +2912,10 @@ static int __init vdo_init(void)
 	/*
 	 * UDS module level initialization must be done first, as VDO initialization depends on it
 	 */
-	uds_initialize_thread_device_registry();
 	uds_memory_init();
 	uds_init_sysfs();
 
+	vdo_initialize_thread_device_registry();
 	vdo_initialize_device_registry_once();
 	uds_log_info("loaded version %s", CURRENT_VERSION);
 
diff --git a/drivers/md/dm-vdo/logger.c b/drivers/md/dm-vdo/logger.c
index 969f10771ada..6ba7e99ee8f9 100644
--- a/drivers/md/dm-vdo/logger.c
+++ b/drivers/md/dm-vdo/logger.c
@@ -176,7 +176,7 @@ static void emit_log_message(int priority, const char *module, const char *prefi
 	}
 
 	/* Not at interrupt level; we have a process we can look at, and might have a device ID. */
-	device_instance = uds_get_thread_device_id();
+	device_instance = vdo_get_thread_device_id();
 	if (device_instance >= 0) {
 		emit_log_message_to_kernel(priority, "%s%u:%s: %s%pV%pV\n", module,
 					   device_instance, current->comm, prefix, vaf1,
diff --git a/drivers/md/dm-vdo/thread-device.c b/drivers/md/dm-vdo/thread-device.c
index 2bf14b9f67f8..df13ca914db8 100644
--- a/drivers/md/dm-vdo/thread-device.c
+++ b/drivers/md/dm-vdo/thread-device.c
@@ -5,24 +5,22 @@
 
 #include "thread-device.h"
 
-#include "thread-registry.h"
-
 /* A registry of threads associated with device id numbers. */
 static struct thread_registry device_id_thread_registry;
 
 /* Any registered thread must be unregistered. */
-void uds_register_thread_device_id(struct registered_thread *new_thread,
+void vdo_register_thread_device_id(struct registered_thread *new_thread,
 				   unsigned int *id_ptr)
 {
 	vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr);
 }
 
-void uds_unregister_thread_device_id(void)
+void vdo_unregister_thread_device_id(void)
 {
 	vdo_unregister_thread(&device_id_thread_registry);
 }
 
-int uds_get_thread_device_id(void)
+int vdo_get_thread_device_id(void)
 {
 	const unsigned int *pointer;
 
@@ -30,7 +28,7 @@ int uds_get_thread_device_id(void)
 	return (pointer != NULL) ? *pointer : -1;
 }
 
-void uds_initialize_thread_device_registry(void)
+void vdo_initialize_thread_device_registry(void)
 {
 	vdo_initialize_thread_registry(&device_id_thread_registry);
 }
diff --git a/drivers/md/dm-vdo/thread-device.h b/drivers/md/dm-vdo/thread-device.h
index 428b2908541d..494d9c9ef3f6 100644
--- a/drivers/md/dm-vdo/thread-device.h
+++ b/drivers/md/dm-vdo/thread-device.h
@@ -3,18 +3,18 @@
  * Copyright 2023 Red Hat
  */
 
-#ifndef UDS_THREAD_DEVICE_H
-#define UDS_THREAD_DEVICE_H
+#ifndef VDO_THREAD_DEVICE_H
+#define VDO_THREAD_DEVICE_H
 
 #include "thread-registry.h"
 
-void uds_register_thread_device_id(struct registered_thread *new_thread,
+void vdo_register_thread_device_id(struct registered_thread *new_thread,
 				   unsigned int *id_ptr);
 
-void uds_unregister_thread_device_id(void);
+void vdo_unregister_thread_device_id(void);
 
-int uds_get_thread_device_id(void);
+int vdo_get_thread_device_id(void);
 
-void uds_initialize_thread_device_registry(void);
+void vdo_initialize_thread_device_registry(void);
 
-#endif /* UDS_THREAD_DEVICE_H */
+#endif /* VDO_THREAD_DEVICE_H */
-- 
2.42.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux