Skip to contentSkip to conversation

dm vdo: standardize on VDO_SUCCESS

PATCH New Matthew Sakai 1 participant 11 messages Mar 1, 2024

Subsystems (2)
lore
Share & tools
lore

Matthew Sakai

author maintainer
#0 lore raw

cover dm vdo: standardize on VDO_SUCCESS

Clean up code to consistently return and check for appropriate return values, usually VDO_SUCCESS.

Matthew Sakai (2):
dm vdo errors: remove unused error codes
dm vdo indexer: update ASSERT and ASSERT_LOG_ONLY usage

Mike Snitzer (8):
dm vdo memory-alloc: return VDO_SUCCESS on success
dm vdo: check for VDO_SUCCESS return value from memory-alloc functions dm vdo int-map: return VDO_SUCCESS on success
dm vdo thread-utils: return VDO_SUCCESS on vdo_create_thread success dm-vdo funnel-workqueue: return VDO_SUCCESS from
make_simple_work_queue
dm vdo permassert: audit all of ASSERT to test for VDO_SUCCESS dm vdo encodings: update some stale comments
dm vdo target: eliminate inappropriate uses of UDS_SUCCESS

 drivers/md/dm-vdo/action-manager.c            |   8 +-
 drivers/md/dm-vdo/block-map.c                 | 128 +++++++-------
 drivers/md/dm-vdo/completion.c                |  10 +-
 drivers/md/dm-vdo/completion.h                |   6 +-
 drivers/md/dm-vdo/data-vio.c                  | 110 ++++++------
 drivers/md/dm-vdo/data-vio.h                  |  68 ++++----
 drivers/md/dm-vdo/dedupe.c                    | 165 +++++++++---------
 drivers/md/dm-vdo/dm-vdo-target.c             |  70 ++++----
 drivers/md/dm-vdo/encodings.c                 | 162 +++++++++--------
 drivers/md/dm-vdo/errors.c                    |   9 +-
 drivers/md/dm-vdo/errors.h                    |  13 +-
 drivers/md/dm-vdo/flush.c                     |  22 +--
 drivers/md/dm-vdo/funnel-queue.c              |   2 +-
 drivers/md/dm-vdo/funnel-workqueue.c          |  30 ++--
 drivers/md/dm-vdo/indexer/chapter-index.c     |  18 +-
 drivers/md/dm-vdo/indexer/config.c            |  18 +-
 drivers/md/dm-vdo/indexer/delta-index.c       | 100 +++++------
 .../md/dm-vdo/indexer/funnel-requestqueue.c   |   4 +-
 drivers/md/dm-vdo/indexer/geometry.c          |   2 +-
 drivers/md/dm-vdo/indexer/index-layout.c      |  23 +--
 drivers/md/dm-vdo/indexer/index-page-map.c    |   8 +-
 drivers/md/dm-vdo/indexer/index-session.c     |  14 +-
 drivers/md/dm-vdo/indexer/index.c             |  18 +-
 drivers/md/dm-vdo/indexer/io-factory.c        |   6 +-
 drivers/md/dm-vdo/indexer/open-chapter.c      |   4 +-
 drivers/md/dm-vdo/indexer/radix-sort.c        |   2 +-
 drivers/md/dm-vdo/indexer/sparse-cache.c      |   8 +-
 drivers/md/dm-vdo/indexer/volume-index.c      |  38 ++--
 drivers/md/dm-vdo/indexer/volume.c            |  48 ++---
 drivers/md/dm-vdo/int-map.c                   |  38 ++--
 drivers/md/dm-vdo/io-submitter.c              |  12 +-
 drivers/md/dm-vdo/logical-zone.c              |  22 +--
 drivers/md/dm-vdo/memory-alloc.c              |  36 ++--
 drivers/md/dm-vdo/memory-alloc.h              |   8 +-
 drivers/md/dm-vdo/message-stats.c             |   2 +-
 drivers/md/dm-vdo/packer.c                    |  12 +-
 drivers/md/dm-vdo/permassert.c                |   2 +-
 drivers/md/dm-vdo/permassert.h                |  15 +-
 drivers/md/dm-vdo/physical-zone.c             |  48 ++---
 drivers/md/dm-vdo/priority-table.c            |   4 +-
 drivers/md/dm-vdo/recovery-journal.c          |  60 +++----
 drivers/md/dm-vdo/repair.c                    |  12 +-
 drivers/md/dm-vdo/slab-depot.c                | 118 ++++++-------
 drivers/md/dm-vdo/status-codes.c              |  10 --
 drivers/md/dm-vdo/status-codes.h              |  32 +---
 drivers/md/dm-vdo/thread-registry.c           |   4 +-
 drivers/md/dm-vdo/thread-utils.c              |   4 +-
 drivers/md/dm-vdo/uds-sysfs.c                 |   2 +-
 drivers/md/dm-vdo/vdo.c                       |  34 ++--
 drivers/md/dm-vdo/vio.c                       |  40 ++---
 drivers/md/dm-vdo/vio.h                       |   8 +-
 51 files changed, 794 insertions(+), 843 deletions(-)
Signature · 1 line
2.42.0
author maintainer
#1 lore raw

PATCH 1/10 dm vdo errors: remove unused error codes

Also define VDO_SUCCESS in a more central location, and rename error block constants for clarity.

---
 drivers/md/dm-vdo/errors.c       |  4 ----
 drivers/md/dm-vdo/errors.h       | 13 +++----------
 drivers/md/dm-vdo/status-codes.c | 10 ----------
 drivers/md/dm-vdo/status-codes.h | 32 +++++---------------------------
 4 files changed, 8 insertions(+), 51 deletions(-)
drivers/md/dm-vdo/errors.c +0 -4
index dc1f0533bd7a..df2498553312 100644
@@ -58,13 +58,9 @@ static const struct error_info error_list[] = {
 	{ "UDS_DUPLICATE_NAME", "Attempt to enter the same name into a delta index twice" },
 	{ "UDS_ASSERTION_FAILED", "Assertion failed" },
 	{ "UDS_QUEUED", "Request queued" },
-	{ "UDS_BUFFER_ERROR", "Buffer error" },
-	{ "UDS_NO_DIRECTORY", "Expected directory is missing" },
 	{ "UDS_ALREADY_REGISTERED", "Error range already registered" },
 	{ "UDS_OUT_OF_RANGE", "Cannot access data outside specified limits" },
-	{ "UDS_EMODULE_LOAD", "Could not load modules" },
 	{ "UDS_DISABLED", "UDS library context is disabled" },
-	{ "UDS_UNKNOWN_ERROR", "Unknown error" },
 	{ "UDS_UNSUPPORTED_VERSION", "Unsupported version" },
 	{ "UDS_CORRUPT_DATA", "Some index structure is corrupt" },
 	{ "UDS_NO_INDEX", "No index found" },
drivers/md/dm-vdo/errors.h +3 -10
index cf15d7243204..c6c085b26a0e 100644
@@ -9,12 +9,13 @@
 #include <linux/compiler.h>
 #include <linux/types.h>
 
-/* Custom error codes and error-related utilities for UDS */
+/* Custom error codes and error-related utilities */
+#define VDO_SUCCESS 0
 
 /* Valid status codes for internal UDS functions. */
 enum uds_status_codes {
 	/* Successful return */
-	UDS_SUCCESS = 0,
+	UDS_SUCCESS = VDO_SUCCESS,
 	/* Used as a base value for reporting internal errors */
 	UDS_ERROR_CODE_BASE = 1024,
 	/* Index overflow */
@@ -29,20 +30,12 @@ enum uds_status_codes {
 	UDS_ASSERTION_FAILED,
 	/* A request has been queued for later processing (not an error) */
 	UDS_QUEUED,
-	/* A problem has occurred with a buffer */
-	UDS_BUFFER_ERROR,
-	/* No directory was found where one was expected */
-	UDS_NO_DIRECTORY,
 	/* This error range has already been registered */
 	UDS_ALREADY_REGISTERED,
 	/* Attempt to read or write data outside the valid range */
 	UDS_OUT_OF_RANGE,
-	/* Could not load modules */
-	UDS_EMODULE_LOAD,
 	/* The index session is disabled */
 	UDS_DISABLED,
-	/* Unknown error */
-	UDS_UNKNOWN_ERROR,
 	/* The index configuration or volume format is no longer supported */
 	UDS_UNSUPPORTED_VERSION,
 	/* Some index structure is corrupt */
drivers/md/dm-vdo/status-codes.c +0 -10
index efba1ead0aca..92c42b8bbb8b 100644
@@ -15,22 +15,16 @@ const struct error_info vdo_status_list[] = {
 	{ "VDO_OUT_OF_RANGE", "Out of range" },
 	{ "VDO_REF_COUNT_INVALID", "Reference count would become invalid" },
 	{ "VDO_NO_SPACE", "Out of space" },
-	{ "VDO_UNEXPECTED_EOF", "Unexpected EOF on block read" },
 	{ "VDO_BAD_CONFIGURATION", "Bad configuration option" },
-	{ "VDO_SOCKET_ERROR", "Socket error" },
-	{ "VDO_BAD_ALIGNMENT", "Mis-aligned block reference" },
 	{ "VDO_COMPONENT_BUSY", "Prior operation still in progress" },
 	{ "VDO_BAD_PAGE", "Corrupt or incorrect page" },
 	{ "VDO_UNSUPPORTED_VERSION", "Unsupported component version" },
 	{ "VDO_INCORRECT_COMPONENT", "Component id mismatch in decoder" },
 	{ "VDO_PARAMETER_MISMATCH", "Parameters have conflicting values" },
-	{ "VDO_BLOCK_SIZE_TOO_SMALL", "The block size is too small" },
 	{ "VDO_UNKNOWN_PARTITION", "No partition exists with a given id" },
 	{ "VDO_PARTITION_EXISTS", "A partition already exists with a given id" },
-	{ "VDO_NOT_READ_ONLY", "The device is not in read-only mode" },
 	{ "VDO_INCREMENT_TOO_SMALL", "Physical block growth of too few blocks" },
 	{ "VDO_CHECKSUM_MISMATCH", "Incorrect checksum" },
-	{ "VDO_RECOVERY_JOURNAL_FULL", "The recovery journal is full" },
 	{ "VDO_LOCK_ERROR", "A lock is held incorrectly" },
 	{ "VDO_READ_ONLY", "The device is in read-only mode" },
 	{ "VDO_SHUTTING_DOWN", "The device is shutting down" },
@@ -38,11 +32,7 @@ const struct error_info vdo_status_list[] = {
 	{ "VDO_TOO_MANY_SLABS", "Exceeds maximum number of slabs supported" },
 	{ "VDO_INVALID_FRAGMENT", "Compressed block fragment is invalid" },
 	{ "VDO_RETRY_AFTER_REBUILD", "Retry operation after rebuilding finishes" },
-	{ "VDO_UNKNOWN_COMMAND", "The extended command is not known" },
-	{ "VDO_COMMAND_ERROR", "Bad extended command parameters" },
-	{ "VDO_CANNOT_DETERMINE_SIZE", "Cannot determine config sizes to fit" },
 	{ "VDO_BAD_MAPPING", "Invalid page mapping" },
-	{ "VDO_READ_CACHE_BUSY", "Read cache has no free slots" },
 	{ "VDO_BIO_CREATION_FAILED", "Bio creation failed" },
 	{ "VDO_BAD_MAGIC", "Bad magic number" },
 	{ "VDO_BAD_NONCE", "Bad nonce" },
drivers/md/dm-vdo/status-codes.h +5 -27
index 5d1e8bbe54b4..eb847def8eb4 100644
@@ -9,17 +9,15 @@
 #include "errors.h"
 
 enum {
-	UDS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE,
-	VDO_BLOCK_START = UDS_ERROR_CODE_BLOCK_END,
-	VDO_BLOCK_END = VDO_BLOCK_START + UDS_BLOCK_SIZE,
+	UDS_ERRORS_BLOCK_SIZE = UDS_ERROR_CODE_BLOCK_END - UDS_ERROR_CODE_BASE,
+	VDO_ERRORS_BLOCK_START = UDS_ERROR_CODE_BLOCK_END,
+	VDO_ERRORS_BLOCK_END = VDO_ERRORS_BLOCK_START + UDS_ERRORS_BLOCK_SIZE,
 };
 
 /* VDO-specific status codes. */
 enum vdo_status_codes {
-	/* successful result */
-	VDO_SUCCESS = UDS_SUCCESS,
 	/* base of all VDO errors */
-	VDO_STATUS_CODE_BASE = VDO_BLOCK_START,
+	VDO_STATUS_CODE_BASE = VDO_ERRORS_BLOCK_START,
 	/* we haven't written this yet */
 	VDO_NOT_IMPLEMENTED = VDO_STATUS_CODE_BASE,
 	/* input out of range */
@@ -28,14 +26,8 @@ enum vdo_status_codes {
 	VDO_REF_COUNT_INVALID,
 	/* a free block could not be allocated */
 	VDO_NO_SPACE,
-	/* unexpected EOF on block read */
-	VDO_UNEXPECTED_EOF,
 	/* improper or missing configuration option */
 	VDO_BAD_CONFIGURATION,
-	/* socket opening or binding problem */
-	VDO_SOCKET_ERROR,
-	/* read or write on non-aligned offset */
-	VDO_BAD_ALIGNMENT,
 	/* prior operation still in progress */
 	VDO_COMPONENT_BUSY,
 	/* page contents incorrect or corrupt data */
@@ -46,20 +38,14 @@ enum vdo_status_codes {
 	VDO_INCORRECT_COMPONENT,
 	/* parameters have conflicting values */
 	VDO_PARAMETER_MISMATCH,
-	/* the block size is too small */
-	VDO_BLOCK_SIZE_TOO_SMALL,
 	/* no partition exists with a given id */
 	VDO_UNKNOWN_PARTITION,
 	/* a partition already exists with a given id */
 	VDO_PARTITION_EXISTS,
-	/* the VDO is not in read-only mode */
-	VDO_NOT_READ_ONLY,
 	/* physical block growth of too few blocks */
 	VDO_INCREMENT_TOO_SMALL,
 	/* incorrect checksum */
 	VDO_CHECKSUM_MISMATCH,
-	/* the recovery journal is full */
-	VDO_RECOVERY_JOURNAL_FULL,
 	/* a lock is held incorrectly */
 	VDO_LOCK_ERROR,
 	/* the VDO is in read-only mode */
@@ -74,16 +60,8 @@ enum vdo_status_codes {
 	VDO_INVALID_FRAGMENT,
 	/* action is unsupported while rebuilding */
 	VDO_RETRY_AFTER_REBUILD,
-	/* the extended command is not known */
-	VDO_UNKNOWN_COMMAND,
-	/* bad extended command parameters */
-	VDO_COMMAND_ERROR,
-	/* cannot determine sizes to fit */
-	VDO_CANNOT_DETERMINE_SIZE,
 	/* a block map entry is invalid */
 	VDO_BAD_MAPPING,
-	/* read cache has no free slots */
-	VDO_READ_CACHE_BUSY,
 	/* bio_add_page failed */
 	VDO_BIO_CREATION_FAILED,
 	/* bad magic number */
@@ -98,7 +76,7 @@ enum vdo_status_codes {
 	VDO_CANT_ADD_SYSFS_NODE,
 	/* one more than last error code */
 	VDO_STATUS_CODE_LAST,
-	VDO_STATUS_CODE_BLOCK_END = VDO_BLOCK_END
+	VDO_STATUS_CODE_BLOCK_END = VDO_ERRORS_BLOCK_END
 };
 
 extern const struct error_info vdo_status_list[];
Signature · 1 line
2.42.0
author maintainer
#2 lore raw

PATCH 2/10 dm vdo memory-alloc: return VDO_SUCCESS on success

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

---
 drivers/md/dm-vdo/memory-alloc.c | 24 ++++++++++++------------
 drivers/md/dm-vdo/memory-alloc.h |  8 ++++----
 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/md/dm-vdo/memory-alloc.c +12 -12
index 8d5df3e45a24..dd5acc582fb3 100644
@@ -194,7 +194,7 @@ static inline bool use_kmalloc(size_t size)
  * @what: What is being allocated (for error logging)
  * @ptr: A pointer to hold the allocated memory
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
 {
@@ -216,12 +216,12 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
 	unsigned long start_time;
 	void *p = NULL;
 
-	if (ptr == NULL)
-		return UDS_INVALID_ARGUMENT;
+	if (unlikely(ptr == NULL))
+		return -EINVAL;
 
 	if (size == 0) {
 		*((void **) ptr) = NULL;
-		return UDS_SUCCESS;
+		return VDO_SUCCESS;
 	}
 
 	if (allocations_restricted)
@@ -245,7 +245,7 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
 	} else {
 		struct vmalloc_block_info *block;
 
-		if (vdo_allocate(1, struct vmalloc_block_info, __func__, &block) == UDS_SUCCESS) {
+		if (vdo_allocate(1, struct vmalloc_block_info, __func__, &block) == VDO_SUCCESS) {
 			/*
 			 * It is possible for __vmalloc to fail to allocate memory because there
 			 * are no pages available. A short sleep may allow the page reclaimer
@@ -290,7 +290,7 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
 	}
 
 	*((void **) ptr) = p;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /*
@@ -335,7 +335,7 @@ void vdo_free(void *ptr)
  * @what: What is being allocated (for error logging)
  * @new_ptr: A pointer to hold the reallocated pointer
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *what,
 			  void *new_ptr)
@@ -345,11 +345,11 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
 	if (size == 0) {
 		vdo_free(ptr);
 		*(void **) new_ptr = NULL;
-		return UDS_SUCCESS;
+		return VDO_SUCCESS;
 	}
 
 	result = vdo_allocate(size, char, what, new_ptr);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	if (ptr != NULL) {
@@ -360,7 +360,7 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
 		vdo_free(ptr);
 	}
 
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 int vdo_duplicate_string(const char *string, const char *what, char **new_string)
@@ -369,12 +369,12 @@ int vdo_duplicate_string(const char *string, const char *what, char **new_string
 	u8 *dup;
 
 	result = vdo_allocate(strlen(string) + 1, u8, what, &dup);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	memcpy(dup, string, strlen(string) + 1);
 	*new_string = dup;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 void vdo_memory_init(void)
drivers/md/dm-vdo/memory-alloc.h +4 -4
index 1401843db5e0..0093d9f940d9 100644
@@ -35,7 +35,7 @@ int __must_check vdo_allocate_memory(size_t size, size_t align, const char *what
  * @what: What is being allocated (for error logging)
  * @ptr: A pointer to hold the allocated memory
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,
 				      size_t align, const char *what, void *ptr)
@@ -65,7 +65,7 @@ static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,
  * @WHAT: What is being allocated (for error logging)
  * @PTR: A pointer to hold the allocated memory
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 #define vdo_allocate(COUNT, TYPE, WHAT, PTR) \
 	__vdo_do_allocation(COUNT, sizeof(TYPE), 0, __alignof__(TYPE), WHAT, PTR)
@@ -81,7 +81,7 @@ static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,
  * @WHAT: What is being allocated (for error logging)
  * @PTR: A pointer to hold the allocated memory
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 #define vdo_allocate_extended(TYPE1, COUNT, TYPE2, WHAT, PTR)		\
 	__extension__({							\
@@ -105,7 +105,7 @@ static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,
  * @what: What is being allocated (for error logging)
  * @ptr: A pointer to hold the allocated memory
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  */
 static inline int __must_check vdo_allocate_cache_aligned(size_t size, const char *what, void *ptr)
 {
Signature · 1 line
2.42.0
author maintainer
#3 lore raw

PATCH 3/10 dm vdo: check for VDO_SUCCESS return value from memory-alloc functions

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

VDO_SUCCESS and UDS_SUCCESS were used interchangably, update all callers of VDO's memory-alloc functions to consistently check for VDO_SUCCESS.

---
 drivers/md/dm-vdo/block-map.c                  |  6 +++---
 drivers/md/dm-vdo/data-vio.c                   |  2 +-
 drivers/md/dm-vdo/dm-vdo-target.c              | 18 +++++++++---------
 drivers/md/dm-vdo/encodings.c                  |  2 +-
 drivers/md/dm-vdo/funnel-queue.c               |  2 +-
 drivers/md/dm-vdo/funnel-workqueue.c           |  6 +++---
 drivers/md/dm-vdo/indexer/chapter-index.c      |  2 +-
 drivers/md/dm-vdo/indexer/config.c             |  2 +-
 drivers/md/dm-vdo/indexer/delta-index.c        | 10 +++++-----
 .../md/dm-vdo/indexer/funnel-requestqueue.c    |  2 +-
 drivers/md/dm-vdo/indexer/geometry.c           |  2 +-
 drivers/md/dm-vdo/indexer/index-layout.c       | 18 +++++++++---------
 drivers/md/dm-vdo/indexer/index-page-map.c     |  8 ++++----
 drivers/md/dm-vdo/indexer/index-session.c      |  2 +-
 drivers/md/dm-vdo/indexer/index.c              | 12 ++++++------
 drivers/md/dm-vdo/indexer/io-factory.c         |  6 +++---
 drivers/md/dm-vdo/indexer/open-chapter.c       |  4 ++--
 drivers/md/dm-vdo/indexer/radix-sort.c         |  2 +-
 drivers/md/dm-vdo/indexer/sparse-cache.c       |  8 ++++----
 drivers/md/dm-vdo/indexer/volume-index.c       |  6 +++---
 drivers/md/dm-vdo/indexer/volume.c             | 14 +++++++-------
 drivers/md/dm-vdo/int-map.c                    | 18 +++++++++---------
 drivers/md/dm-vdo/io-submitter.c               |  2 +-
 drivers/md/dm-vdo/message-stats.c              |  2 +-
 drivers/md/dm-vdo/slab-depot.c                 |  2 +-
 drivers/md/dm-vdo/thread-utils.c               |  2 +-
 drivers/md/dm-vdo/uds-sysfs.c                  |  2 +-
 drivers/md/dm-vdo/vdo.c                        |  2 +-
 28 files changed, 82 insertions(+), 82 deletions(-)
drivers/md/dm-vdo/block-map.c +3 -3
index b09974ad41d2..c4719fb30f86 100644
@@ -223,11 +223,11 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
 
 	result = vdo_allocate(cache->page_count, struct page_info, "page infos",
 			      &cache->infos);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate_memory(size, VDO_BLOCK_SIZE, "cache pages", &cache->pages);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_int_map_create(cache->page_count, &cache->page_map);
@@ -2874,7 +2874,7 @@ int vdo_decode_block_map(struct block_map_state_2_0 state, block_count_t logical
 	result = vdo_allocate_extended(struct block_map,
 				       vdo->thread_config.logical_zone_count,
 				       struct block_map_zone, __func__, &map);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	map->vdo = vdo;
drivers/md/dm-vdo/data-vio.c +1 -1
index dcdd767e40e5..3d5054e61330 100644
@@ -847,7 +847,7 @@ int make_data_vio_pool(struct vdo *vdo, data_vio_count_t pool_size,
 
 	result = vdo_allocate_extended(struct data_vio_pool, pool_size, struct data_vio,
 				       __func__, &pool);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	ASSERT_LOG_ONLY((discard_limit <= pool_size),
drivers/md/dm-vdo/dm-vdo-target.c +9 -9
index 86c30fbd75ca..90ba379f8d3e 100644
@@ -280,7 +280,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
 
 	result = vdo_allocate(substring_count + 1, char *, "string-splitting array",
 			      &substrings);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	for (s = string; *s != 0; s++) {
@@ -289,7 +289,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
 
 			result = vdo_allocate(length + 1, char, "split string",
 					      &substrings[current_substring]);
-			if (result != UDS_SUCCESS) {
+			if (result != VDO_SUCCESS) {
 				free_string_array(substrings);
 				return result;
 			}
@@ -310,7 +310,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
 
 	result = vdo_allocate(length + 1, char, "split string",
 			      &substrings[current_substring]);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		free_string_array(substrings);
 		return result;
 	}
@@ -1527,7 +1527,7 @@ static size_t get_bit_array_size(unsigned int bit_count)
  * Since the array is initially NULL, this also initializes the array the first time we allocate an
  * instance number.
  *
- * Return: UDS_SUCCESS or an error code from the allocation
+ * Return: VDO_SUCCESS or an error code from the allocation
  */
 static int grow_bit_array(void)
 {
@@ -1540,19 +1540,19 @@ static int grow_bit_array(void)
 				       get_bit_array_size(instances.bit_count),
 				       get_bit_array_size(new_count),
 				       "instance number bit array", &new_words);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	instances.bit_count = new_count;
 	instances.words = new_words;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
  * allocate_instance() - Allocate an instance number.
  * @instance_ptr: A point to hold the instance number
  *
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
  *
  * This function must be called while holding the instances lock.
  */
@@ -1564,7 +1564,7 @@ static int allocate_instance(unsigned int *instance_ptr)
 	/* If there are no unallocated instances, grow the bit array. */
 	if (instances.count >= instances.bit_count) {
 		result = grow_bit_array();
-		if (result != UDS_SUCCESS)
+		if (result != VDO_SUCCESS)
 			return result;
 	}
 
@@ -1587,7 +1587,7 @@ static int allocate_instance(unsigned int *instance_ptr)
 	instances.count++;
 	instances.next = instance + 1;
 	*instance_ptr = instance;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 static int construct_new_vdo_registered(struct dm_target *ti, unsigned int argc,
drivers/md/dm-vdo/encodings.c +1 -1
index 56d94339d2af..a97771fe0a43 100644
@@ -800,7 +800,7 @@ static int allocate_partition(struct layout *layout, u8 id,
 	int result;
 
 	result = vdo_allocate(1, struct partition, __func__, &partition);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	partition->id = id;
drivers/md/dm-vdo/funnel-queue.c +1 -1
index 67f7b52ecc86..ce0e801fd955 100644
@@ -15,7 +15,7 @@ int uds_make_funnel_queue(struct funnel_queue **queue_ptr)
 	struct funnel_queue *queue;
 
 	result = vdo_allocate(1, struct funnel_queue, "funnel queue", &queue);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	/*
drivers/md/dm-vdo/funnel-workqueue.c +3 -3
index ebf8dce67086..a88f5c93eae5 100644
@@ -324,7 +324,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, const char *na
 			VDO_WORK_Q_MAX_PRIORITY);
 
 	result = vdo_allocate(1, struct simple_work_queue, "simple work queue", &queue);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	queue->private = private;
@@ -401,12 +401,12 @@ int vdo_make_work_queue(const char *thread_name_prefix, const char *name,
 
 	result = vdo_allocate(1, struct round_robin_work_queue, "round-robin work queue",
 			      &queue);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(thread_count, struct simple_work_queue *,
 			      "subordinate work queues", &queue->service_queues);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		vdo_free(queue);
 		return result;
 	}
drivers/md/dm-vdo/indexer/chapter-index.c +1 -1
index 9477150362ae..68d86028dbb7 100644
@@ -21,7 +21,7 @@ int uds_make_open_chapter_index(struct open_chapter_index **chapter_index,
 	struct open_chapter_index *index;
 
 	result = vdo_allocate(1, struct open_chapter_index, "open chapter index", &index);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	/*
drivers/md/dm-vdo/indexer/config.c +1 -1
index cd20ee8b9a02..5da39043b9ae 100644
@@ -326,7 +326,7 @@ int uds_make_configuration(const struct uds_parameters *params,
 		return result;
 
 	result = vdo_allocate(1, struct uds_configuration, __func__, &config);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_make_index_geometry(DEFAULT_BYTES_PER_PAGE, record_pages_per_chapter,
drivers/md/dm-vdo/indexer/delta-index.c +5 -5
index 11f7b85b6710..5bba9a48c5a0 100644
@@ -312,18 +312,18 @@ static int initialize_delta_zone(struct delta_zone *delta_zone, size_t size,
 	int result;
 
 	result = vdo_allocate(size, u8, "delta list", &delta_zone->memory);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(list_count + 2, u64, "delta list temp",
 			      &delta_zone->new_offsets);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	/* Allocate the delta lists. */
 	result = vdo_allocate(list_count + 2, struct delta_list, "delta lists",
 			      &delta_zone->delta_lists);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	compute_coding_constants(mean_delta, &delta_zone->min_bits,
@@ -354,7 +354,7 @@ int uds_initialize_delta_index(struct delta_index *delta_index, unsigned int zon
 
 	result = vdo_allocate(zone_count, struct delta_zone, "Delta Index Zones",
 			      &delta_index->delta_zones);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	delta_index->zone_count = zone_count;
@@ -1048,7 +1048,7 @@ int uds_finish_restoring_delta_index(struct delta_index *delta_index,
 	u8 *data;
 
 	result = vdo_allocate(DELTA_LIST_MAX_BYTE_COUNT, u8, __func__, &data);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	for (z = 0; z < reader_count; z++) {
drivers/md/dm-vdo/indexer/funnel-requestqueue.c +1 -1
index 95a402ec31c9..eee7b980960f 100644
@@ -199,7 +199,7 @@ int uds_make_request_queue(const char *queue_name,
 	struct uds_request_queue *queue;
 
 	result = vdo_allocate(1, struct uds_request_queue, __func__, &queue);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	queue->processor = processor;
drivers/md/dm-vdo/indexer/geometry.c +1 -1
index c735e6cb4425..c0575612e820 100644
@@ -62,7 +62,7 @@ int uds_make_index_geometry(size_t bytes_per_page, u32 record_pages_per_chapter,
 	struct index_geometry *geometry;
 
 	result = vdo_allocate(1, struct index_geometry, "geometry", &geometry);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	geometry->bytes_per_page = bytes_per_page;
drivers/md/dm-vdo/indexer/index-layout.c +9 -9
index c1bcff03cc55..01e0db4184aa 100644
@@ -487,7 +487,7 @@ static int __must_check make_index_save_region_table(struct index_save_layout *i
 	result = vdo_allocate_extended(struct region_table, region_count,
 				       struct layout_region,
 				       "layout region table for ISL", &table);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	lr = &table->regions[0];
@@ -546,7 +546,7 @@ static int __must_check write_index_save_header(struct index_save_layout *isl,
 	size_t offset = 0;
 
 	result = vdo_allocate(table->encoded_size, u8, "index save data", &buffer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	encode_region_table(buffer, &offset, table);
@@ -670,7 +670,7 @@ static int __must_check make_layout_region_table(struct index_layout *layout,
 	result = vdo_allocate_extended(struct region_table, region_count,
 				       struct layout_region, "layout region table",
 				       &table);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	lr = &table->regions[0];
@@ -716,7 +716,7 @@ static int __must_check write_layout_header(struct index_layout *layout,
 	size_t offset = 0;
 
 	result = vdo_allocate(table->encoded_size, u8, "layout data", &buffer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	encode_region_table(buffer, &offset, table);
@@ -807,7 +807,7 @@ static int create_index_layout(struct index_layout *layout, struct uds_configura
 
 	result = vdo_allocate(sizes.save_count, struct index_save_layout, __func__,
 			      &layout->index.saves);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	initialize_layout(layout, &sizes);
@@ -1165,7 +1165,7 @@ static int __must_check load_region_table(struct buffered_reader *reader,
 	result = vdo_allocate_extended(struct region_table, header.region_count,
 				       struct layout_region,
 				       "single file layout region table", &table);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	table->header = header;
@@ -1202,7 +1202,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader,
 	size_t offset = 0;
 
 	result = vdo_allocate(saved_size, u8, "super block data", &buffer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_read_from_buffered_reader(reader, buffer, saved_size);
@@ -1337,7 +1337,7 @@ static int __must_check reconstitute_layout(struct index_layout *layout,
 
 	result = vdo_allocate(layout->super.max_saves, struct index_save_layout,
 			      __func__, &layout->index.saves);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	layout->total_blocks = table->header.region_blocks;
@@ -1696,7 +1696,7 @@ int uds_make_index_layout(struct uds_configuration *config, bool new_layout,
 		return result;
 
 	result = vdo_allocate(1, struct index_layout, __func__, &layout);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = create_layout_factory(layout, config);
drivers/md/dm-vdo/indexer/index-page-map.c +4 -4
index ddb6d843cbd9..c5d1b9995846 100644
@@ -39,14 +39,14 @@ int uds_make_index_page_map(const struct index_geometry *geometry,
 	struct index_page_map *map;
 
 	result = vdo_allocate(1, struct index_page_map, "page map", &map);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	map->geometry = geometry;
 	map->entries_per_chapter = geometry->index_pages_per_chapter - 1;
 	result = vdo_allocate(get_entry_count(geometry), u16, "Index Page Map Entries",
 			      &map->entries);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_index_page_map(map);
 		return result;
 	}
@@ -119,7 +119,7 @@ int uds_write_index_page_map(struct index_page_map *map, struct buffered_writer
 	u32 i;
 
 	result = vdo_allocate(saved_size, u8, "page map data", &buffer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	memcpy(buffer, PAGE_MAP_MAGIC, PAGE_MAP_MAGIC_LENGTH);
@@ -146,7 +146,7 @@ int uds_read_index_page_map(struct index_page_map *map, struct buffered_reader *
 	u32 i;
 
 	result = vdo_allocate(saved_size, u8, "page map data", &buffer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_read_from_buffered_reader(reader, buffer, saved_size);
drivers/md/dm-vdo/indexer/index-session.c +1 -1
index 0f920a583021..22445dcb3fe0 100644
@@ -222,7 +222,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **inde
 	struct uds_index_session *session;
 
 	result = vdo_allocate(1, struct uds_index_session, __func__, &session);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	mutex_init(&session->request_mutex);
drivers/md/dm-vdo/indexer/index.c +6 -6
index c576033b8a53..243a9deab4de 100644
@@ -89,7 +89,7 @@ static int launch_zone_message(struct uds_zone_message message, unsigned int zon
 	struct uds_request *request;
 
 	result = vdo_allocate(1, struct uds_request, __func__, &request);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	request->index = index;
@@ -770,7 +770,7 @@ static int make_chapter_writer(struct uds_index *index,
 	result = vdo_allocate_extended(struct chapter_writer, index->zone_count,
 				       struct open_chapter_zone *, "Chapter Writer",
 				       &writer);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	writer->index = index;
@@ -779,7 +779,7 @@ static int make_chapter_writer(struct uds_index *index,
 
 	result = vdo_allocate_cache_aligned(collated_records_size, "collated records",
 					    &writer->collated_records);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		free_chapter_writer(writer);
 		return result;
 	}
@@ -1127,7 +1127,7 @@ static int make_index_zone(struct uds_index *index, unsigned int zone_number)
 	struct index_zone *zone;
 
 	result = vdo_allocate(1, struct index_zone, "index zone", &zone);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_make_open_chapter(index->volume->geometry, index->zone_count,
@@ -1165,7 +1165,7 @@ int uds_make_index(struct uds_configuration *config, enum uds_open_index_type op
 
 	result = vdo_allocate_extended(struct uds_index, config->zone_count,
 				       struct uds_request_queue *, "index", &index);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	index->zone_count = config->zone_count;
@@ -1178,7 +1178,7 @@ int uds_make_index(struct uds_configuration *config, enum uds_open_index_type op
 
 	result = vdo_allocate(index->zone_count, struct index_zone *, "zones",
 			      &index->zones);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_index(index);
 		return result;
 	}
drivers/md/dm-vdo/indexer/io-factory.c +3 -3
index 749c950c0189..0dcf6d596653 100644
@@ -65,7 +65,7 @@ int uds_make_io_factory(struct block_device *bdev, struct io_factory **factory_p
 	struct io_factory *factory;
 
 	result = vdo_allocate(1, struct io_factory, __func__, &factory);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	factory->bdev = bdev;
@@ -145,7 +145,7 @@ int uds_make_buffered_reader(struct io_factory *factory, off_t offset, u64 block
 		return result;
 
 	result = vdo_allocate(1, struct buffered_reader, "buffered reader", &reader);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		dm_bufio_client_destroy(client);
 		return result;
 	}
@@ -283,7 +283,7 @@ int uds_make_buffered_writer(struct io_factory *factory, off_t offset, u64 block
 		return result;
 
 	result = vdo_allocate(1, struct buffered_writer, "buffered writer", &writer);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		dm_bufio_client_destroy(client);
 		return result;
 	}
drivers/md/dm-vdo/indexer/open-chapter.c +2 -2
index 4a4dc94915dd..46b7bc1ac324 100644
@@ -71,14 +71,14 @@ int uds_make_open_chapter(const struct index_geometry *geometry, unsigned int zo
 	result = vdo_allocate_extended(struct open_chapter_zone, slot_count,
 				       struct open_chapter_zone_slot, "open chapter",
 				       &open_chapter);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	open_chapter->slot_count = slot_count;
 	open_chapter->capacity = capacity;
 	result = vdo_allocate_cache_aligned(records_size(open_chapter), "record pages",
 					    &open_chapter->records);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_open_chapter(open_chapter);
 		return result;
 	}
drivers/md/dm-vdo/indexer/radix-sort.c +1 -1
index 74ea18b8e9be..66b8c706a1ef 100644
@@ -213,7 +213,7 @@ int uds_make_radix_sorter(unsigned int count, struct radix_sorter **sorter)
 
 	result = vdo_allocate_extended(struct radix_sorter, stack_size, struct task,
 				       __func__, &radix_sorter);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	radix_sorter->count = count;
drivers/md/dm-vdo/indexer/sparse-cache.c +4 -4
index e297ba2d6ceb..28920167827c 100644
@@ -224,7 +224,7 @@ static int __must_check initialize_cached_chapter_index(struct cached_chapter_in
 
 	result = vdo_allocate(chapter->index_pages_count, struct delta_index_page,
 			      __func__, &chapter->index_pages);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	return vdo_allocate(chapter->index_pages_count, struct dm_buffer *,
@@ -242,7 +242,7 @@ static int __must_check make_search_list(struct sparse_cache *cache,
 	bytes = (sizeof(struct search_list) +
 		 (cache->capacity * sizeof(struct cached_chapter_index *)));
 	result = vdo_allocate_cache_aligned(bytes, "search list", &list);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	list->capacity = cache->capacity;
@@ -265,7 +265,7 @@ int uds_make_sparse_cache(const struct index_geometry *geometry, unsigned int ca
 
 	bytes = (sizeof(struct sparse_cache) + (capacity * sizeof(struct cached_chapter_index)));
 	result = vdo_allocate_cache_aligned(bytes, "sparse cache", &cache);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	cache->geometry = geometry;
@@ -296,7 +296,7 @@ int uds_make_sparse_cache(const struct index_geometry *geometry, unsigned int ca
 	/* purge_search_list() needs some temporary lists for sorting. */
 	result = vdo_allocate(capacity * 2, struct cached_chapter_index *,
 			      "scratch entries", &cache->scratch_entries);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		goto out;
 
 	*cache_ptr = cache;
drivers/md/dm-vdo/indexer/volume-index.c +3 -3
index 1a762e6dd709..1cc9ac4fe510 100644
@@ -1213,7 +1213,7 @@ static int initialize_volume_sub_index(const struct uds_configuration *config,
 	/* The following arrays are initialized to all zeros. */
 	result = vdo_allocate(params.list_count, u64, "first chapter to flush",
 			      &sub_index->flush_chapters);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	return vdo_allocate(zone_count, struct volume_sub_index_zone,
@@ -1229,7 +1229,7 @@ int uds_make_volume_index(const struct uds_configuration *config, u64 volume_non
 	int result;
 
 	result = vdo_allocate(1, struct volume_index, "volume index", &volume_index);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	volume_index->zone_count = config->zone_count;
@@ -1251,7 +1251,7 @@ int uds_make_volume_index(const struct uds_configuration *config, u64 volume_non
 
 	result = vdo_allocate(config->zone_count, struct volume_index_zone,
 			      "volume index zones", &volume_index->zones);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_volume_index(volume_index);
 		return result;
 	}
drivers/md/dm-vdo/indexer/volume.c +7 -7
index 2d8901732f5d..959dd82ef665 100644
@@ -1509,22 +1509,22 @@ static int __must_check initialize_page_cache(struct page_cache *cache,
 
 	result = vdo_allocate(VOLUME_CACHE_MAX_QUEUED_READS, struct queued_read,
 			      "volume read queue", &cache->read_queue);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(cache->zone_count, struct search_pending_counter,
 			      "Volume Cache Zones", &cache->search_pending_counters);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(cache->indexable_pages, u16, "page cache index",
 			      &cache->index);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(cache->cache_slots, struct cached_page, "page cache cache",
 			      &cache->cache);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	/* Initialize index values to invalid values. */
@@ -1547,7 +1547,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
 	int result;
 
 	result = vdo_allocate(1, struct volume, "volume", &volume);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	volume->nonce = uds_get_volume_nonce(layout);
@@ -1586,7 +1586,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
 	result = vdo_allocate(geometry->records_per_page,
 			      const struct uds_volume_record *, "record pointers",
 			      &volume->record_pointers);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_volume(volume);
 		return result;
 	}
@@ -1626,7 +1626,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
 
 	result = vdo_allocate(config->read_threads, struct thread *, "reader threads",
 			      &volume->reader_threads);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_free_volume(volume);
 		return result;
 	}
drivers/md/dm-vdo/int-map.c +9 -9
index 0bd742ecbe2e..9849d12f2a36 100644
@@ -152,7 +152,7 @@ static u64 hash_key(u64 key)
  * @map: The map to initialize.
  * @capacity: The initial capacity of the map.
  *
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
  */
 static int allocate_buckets(struct int_map *map, size_t capacity)
 {
@@ -174,7 +174,7 @@ static int allocate_buckets(struct int_map *map, size_t capacity)
  *                    tells the map to use its own small default).
  * @map_ptr: Output, a pointer to hold the new int_map.
  *
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
  */
 int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr)
 {
@@ -183,7 +183,7 @@ int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr)
 	size_t capacity;
 
 	result = vdo_allocate(1, struct int_map, "struct int_map", &map);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	/* Use the default capacity if the caller did not specify one. */
@@ -196,13 +196,13 @@ int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr)
 	capacity = capacity * 100 / DEFAULT_LOAD;
 
 	result = allocate_buckets(map, capacity);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		vdo_int_map_free(vdo_forget(map));
 		return result;
 	}
 
 	*map_ptr = map;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
@@ -368,7 +368,7 @@ void *vdo_int_map_get(struct int_map *map, u64 key)
  *
  * Resizes and rehashes all the existing entries, storing them in the new buckets.
  *
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
  */
 static int resize_buckets(struct int_map *map)
 {
@@ -384,7 +384,7 @@ static int resize_buckets(struct int_map *map)
 	uds_log_info("%s: attempting resize from %zu to %zu, current size=%zu",
 		     __func__, map->capacity, new_capacity, map->size);
 	result = allocate_buckets(map, new_capacity);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		*map = old_map;
 		return result;
 	}
@@ -407,7 +407,7 @@ static int resize_buckets(struct int_map *map)
 
 	/* Destroy the old bucket array. */
 	vdo_free(vdo_forget(old_map.buckets));
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
@@ -647,7 +647,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
 		 * large maps).
 		 */
 		result = resize_buckets(map);
-		if (result != UDS_SUCCESS)
+		if (result != VDO_SUCCESS)
 			return result;
 
 		/*
drivers/md/dm-vdo/io-submitter.c +1 -1
index 23549b7e9e6d..b0f1ba810cd0 100644
@@ -383,7 +383,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter
 	result = vdo_allocate_extended(struct io_submitter, thread_count,
 				       struct bio_queue_data, "bio submission data",
 				       &io_submitter);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	io_submitter->bio_queue_rotation_interval = rotation_interval;
drivers/md/dm-vdo/message-stats.c +1 -1
index ec24fff2a21b..18c9d2af8aed 100644
@@ -420,7 +420,7 @@ int vdo_write_stats(struct vdo *vdo, char *buf, unsigned int maxlen)
 	int result;
 
 	result = vdo_allocate(1, struct vdo_statistics, __func__, &stats);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_log_error("Cannot allocate memory to write VDO statistics");
 		return result;
 	}
drivers/md/dm-vdo/slab-depot.c +1 -1
index 2d2cccf89edb..97208c9e0062 100644
@@ -2379,7 +2379,7 @@ static int allocate_slab_counters(struct vdo_slab *slab)
 	bytes = (slab->reference_block_count * COUNTS_PER_BLOCK) + (2 * BYTES_PER_WORD);
 	result = vdo_allocate(bytes, vdo_refcount_t, "ref counts array",
 			      &slab->counters);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		vdo_free(vdo_forget(slab->reference_blocks));
 		return result;
 	}
drivers/md/dm-vdo/thread-utils.c +1 -1
index ad7682784459..b4aa71fffdbf 100644
@@ -83,7 +83,7 @@ int vdo_create_thread(void (*thread_function)(void *), void *thread_data,
 	int result;
 
 	result = vdo_allocate(1, struct thread, __func__, &thread);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_log_warning("Error allocating memory for %s", name);
 		return result;
 	}
drivers/md/dm-vdo/uds-sysfs.c +1 -1
index d1d5a30b3717..753d81d6f207 100644
@@ -35,7 +35,7 @@ static char *buffer_to_string(const char *buf, size_t length)
 {
 	char *string;
 
-	if (vdo_allocate(length + 1, char, __func__, &string) != UDS_SUCCESS)
+	if (vdo_allocate(length + 1, char, __func__, &string) != VDO_SUCCESS)
 		return NULL;
 
 	memcpy(string, buf, length);
drivers/md/dm-vdo/vdo.c +1 -1
index ae62f260c5ec..b4dd0634a5cb 100644
@@ -545,7 +545,7 @@ int vdo_make(unsigned int instance, struct device_config *config, char **reason,
 	*reason = "Unspecified error";
 
 	result = vdo_allocate(1, struct vdo, __func__, &vdo);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		*reason = "Cannot allocate VDO";
 		return result;
 	}
Signature · 1 line
2.42.0
author maintainer
#4 lore raw

PATCH 4/10 dm vdo int-map: return VDO_SUCCESS on success

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

Update all callers to check for VDO_SUCCESS (most already did). Also fix whitespace for update_mapping() parameters.

---
 drivers/md/dm-vdo/block-map.c    |  4 ++--
 drivers/md/dm-vdo/int-map.c      | 20 ++++++++------------
 drivers/md/dm-vdo/io-submitter.c |  4 ++--
 3 files changed, 12 insertions(+), 16 deletions(-)
drivers/md/dm-vdo/block-map.c +2 -2
index c4719fb30f86..320e76527e2b 100644
@@ -231,7 +231,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
 		return result;
 
 	result = vdo_int_map_create(cache->page_count, &cache->page_map);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	return initialize_info(cache);
@@ -390,7 +390,7 @@ static int __must_check set_info_pbn(struct page_info *info, physical_block_numb
 
 	if (pbn != NO_PAGE) {
 		result = vdo_int_map_put(cache->page_map, pbn, info, true, NULL);
-		if (result != UDS_SUCCESS)
+		if (result != VDO_SUCCESS)
 			return result;
 	}
 	return VDO_SUCCESS;
drivers/md/dm-vdo/int-map.c +8 -12
index 9849d12f2a36..a909a11204c1 100644
@@ -397,7 +397,7 @@ static int resize_buckets(struct int_map *map)
 			continue;
 
 		result = vdo_int_map_put(map, entry->key, entry->value, true, NULL);
-		if (result != UDS_SUCCESS) {
+		if (result != VDO_SUCCESS) {
 			/* Destroy the new partial map and restore the map from the stack. */
 			vdo_free(vdo_forget(map->buckets));
 			*map = old_map;
@@ -525,12 +525,8 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
  *
  * Return: true if the map contains a mapping for the key, false if it does not.
  */
-static bool update_mapping(struct int_map *map,
-			   struct bucket *neighborhood,
-			   u64 key,
-			   void *new_value,
-			   bool update,
-			   void **old_value_ptr)
+static bool update_mapping(struct int_map *map, struct bucket *neighborhood,
+			   u64 key, void *new_value, bool update, void **old_value_ptr)
 {
 	struct bucket *bucket = search_hop_list(map, neighborhood, key, NULL);
 
@@ -609,15 +605,15 @@ static struct bucket *find_or_make_vacancy(struct int_map *map,
  * update is true. In either case the old value is returned. If the map does not already contain a
  * value for the specified key, the new value is added regardless of the value of update.
  *
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
  */
 int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
 		    void **old_value_ptr)
 {
 	struct bucket *neighborhood, *bucket;
 
-	if (new_value == NULL)
-		return UDS_INVALID_ARGUMENT;
+	if (unlikely(new_value == NULL))
+		return -EINVAL;
 
 	/*
 	 * Select the bucket at the start of the neighborhood that must contain any entry for the
@@ -630,7 +626,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
 	 * optionally update it, returning the old value.
 	 */
 	if (update_mapping(map, neighborhood, key, new_value, update, old_value_ptr))
-		return UDS_SUCCESS;
+		return VDO_SUCCESS;
 
 	/*
 	 * Find an empty bucket in the desired neighborhood for the new entry or re-arrange entries
@@ -666,7 +662,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
 	/* There was no existing entry, so there was no old value to be returned. */
 	if (old_value_ptr != NULL)
 		*old_value_ptr = NULL;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
drivers/md/dm-vdo/io-submitter.c +2 -2
index b0f1ba810cd0..e82b4a8c6fc4 100644
@@ -300,7 +300,7 @@ static bool try_bio_map_merge(struct vio *vio)
 	mutex_unlock(&bio_queue_data->lock);
 
 	/* We don't care about failure of int_map_put in this case. */
-	ASSERT_LOG_ONLY(result == UDS_SUCCESS, "bio map insertion succeeds");
+	ASSERT_LOG_ONLY(result == VDO_SUCCESS, "bio map insertion succeeds");
 	return merged;
 }
 
@@ -403,7 +403,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter
 		 */
 		result = vdo_int_map_create(max_requests_active * 2,
 					    &bio_queue_data->map);
-		if (result != 0) {
+		if (result != VDO_SUCCESS) {
 			/*
 			 * Clean up the partially initialized bio-queue entirely and indicate that
 			 * initialization failed.
Signature · 1 line
2.42.0
author maintainer
#5 lore raw

PATCH 5/10 dm vdo thread-utils: return VDO_SUCCESS on vdo_create_thread success

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

Update all callers to check for VDO_SUCCESS.

---
 drivers/md/dm-vdo/indexer/funnel-requestqueue.c | 2 +-
 drivers/md/dm-vdo/indexer/index.c               | 2 +-
 drivers/md/dm-vdo/indexer/volume.c              | 2 +-
 drivers/md/dm-vdo/thread-utils.c                | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-vdo/indexer/funnel-requestqueue.c +1 -1
index eee7b980960f..84c7c1ae1333 100644
@@ -221,7 +221,7 @@ int uds_make_request_queue(const char *queue_name,
 
 	result = vdo_create_thread(request_queue_worker, queue, queue_name,
 				   &queue->thread);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_request_queue_finish(queue);
 		return result;
 	}
drivers/md/dm-vdo/indexer/index.c +1 -1
index 243a9deab4de..226713221105 100644
@@ -798,7 +798,7 @@ static int make_chapter_writer(struct uds_index *index,
 			       writer->open_chapter_index->memory_size);
 
 	result = vdo_create_thread(close_chapters, writer, "writer", &writer->thread);
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		free_chapter_writer(writer);
 		return result;
 	}
drivers/md/dm-vdo/indexer/volume.c +1 -1
index 959dd82ef665..0a4beef8ac8d 100644
@@ -1634,7 +1634,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
 	for (i = 0; i < config->read_threads; i++) {
 		result = vdo_create_thread(read_thread_function, (void *) volume,
 					   "reader", &volume->reader_threads[i]);
-		if (result != UDS_SUCCESS) {
+		if (result != VDO_SUCCESS) {
 			uds_free_volume(volume);
 			return result;
 		}
drivers/md/dm-vdo/thread-utils.c +1 -1
index b4aa71fffdbf..c822df86f731 100644
@@ -119,7 +119,7 @@ int vdo_create_thread(void (*thread_function)(void *), void *thread_data,
 	}
 
 	*new_thread = thread;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 void vdo_join_threads(struct thread *thread)
Signature · 1 line
2.42.0
author maintainer
#6 lore raw

PATCH 6/10 dm-vdo funnel-workqueue: return VDO_SUCCESS from make_simple_work_queue

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

---
 drivers/md/dm-vdo/funnel-workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-vdo/funnel-workqueue.c +1 -1
index a88f5c93eae5..a923432f0a37 100644
@@ -367,7 +367,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, const char *na
 	wait_for_completion(&started);
 
 	*queue_ptr = queue;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
Signature · 1 line
2.42.0
author maintainer
#7 lore raw

PATCH 7/10 dm vdo permassert: audit all of ASSERT to test for VDO_SUCCESS

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

Also rename ASSERT to VDO_ASSERT and ASSERT_LOG_ONLY to VDO_ASSERT_LOG_ONLY.

But re-introduce ASSERT and ASSERT_LOG_ONLY as a placeholder for the benefit of dm-vdo/indexer.

---
 drivers/md/dm-vdo/action-manager.c   |   8 +-
 drivers/md/dm-vdo/block-map.c        | 118 +++++++++----------
 drivers/md/dm-vdo/completion.c       |  10 +-
 drivers/md/dm-vdo/completion.h       |   6 +-
 drivers/md/dm-vdo/data-vio.c         | 108 +++++++++---------
 drivers/md/dm-vdo/data-vio.h         |  68 +++++------
 drivers/md/dm-vdo/dedupe.c           | 165 +++++++++++++--------------
 drivers/md/dm-vdo/dm-vdo-target.c    |  38 +++---
 drivers/md/dm-vdo/encodings.c        | 156 ++++++++++++-------------
 drivers/md/dm-vdo/errors.c           |   5 +-
 drivers/md/dm-vdo/flush.c            |  22 ++--
 drivers/md/dm-vdo/funnel-workqueue.c |  22 ++--
 drivers/md/dm-vdo/io-submitter.c     |   8 +-
 drivers/md/dm-vdo/logical-zone.c     |  22 ++--
 drivers/md/dm-vdo/memory-alloc.c     |  12 +-
 drivers/md/dm-vdo/packer.c           |  12 +-
 drivers/md/dm-vdo/permassert.h       |  15 ++-
 drivers/md/dm-vdo/physical-zone.c    |  48 ++++----
 drivers/md/dm-vdo/priority-table.c   |   4 +-
 drivers/md/dm-vdo/recovery-journal.c |  60 +++++-----
 drivers/md/dm-vdo/repair.c           |  12 +-
 drivers/md/dm-vdo/slab-depot.c       | 116 +++++++++----------
 drivers/md/dm-vdo/thread-registry.c  |   4 +-
 drivers/md/dm-vdo/vdo.c              |  32 +++---
 drivers/md/dm-vdo/vio.c              |  40 +++----
 drivers/md/dm-vdo/vio.h              |   8 +-
 26 files changed, 561 insertions(+), 558 deletions(-)
drivers/md/dm-vdo/action-manager.c +4 -4
index 709be4c17d27..a0e5e7077d13 100644
@@ -177,8 +177,8 @@ static void apply_to_zone(struct vdo_completion *completion)
 	zone_count_t zone;
 	struct action_manager *manager = as_action_manager(completion);
 
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == get_acting_zone_thread_id(manager)),
-			"%s() called on acting zones's thread", __func__);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == get_acting_zone_thread_id(manager)),
+			    "%s() called on acting zones's thread", __func__);
 
 	zone = manager->acting_zone++;
 	if (manager->acting_zone == manager->zones) {
@@ -357,8 +357,8 @@ bool vdo_schedule_operation_with_context(struct action_manager *manager,
 {
 	struct action *current_action;
 
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == manager->initiator_thread_id),
-			"action initiated from correct thread");
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == manager->initiator_thread_id),
+			    "action initiated from correct thread");
 	if (!manager->current_action->in_use) {
 		current_action = manager->current_action;
 	} else if (!manager->current_action->next->in_use) {
drivers/md/dm-vdo/block-map.c +59 -59

251 lines not on this page · raw message

drivers/md/dm-vdo/completion.c +5 -5
index 9e2381dc3683..5ad85334632d 100644
@@ -60,7 +60,7 @@ void vdo_initialize_completion(struct vdo_completion *completion,
 
 static inline void assert_incomplete(struct vdo_completion *completion)
 {
-	ASSERT_LOG_ONLY(!completion->complete, "completion is not complete");
+	VDO_ASSERT_LOG_ONLY(!completion->complete, "completion is not complete");
 }
 
 /**
@@ -111,10 +111,10 @@ void vdo_enqueue_completion(struct vdo_completion *completion,
 	struct vdo *vdo = completion->vdo;
 	thread_id_t thread_id = completion->callback_thread_id;
 
-	if (ASSERT(thread_id < vdo->thread_config.thread_count,
-		   "thread_id %u (completion type %d) is less than thread count %u",
-		   thread_id, completion->type,
-		   vdo->thread_config.thread_count) != UDS_SUCCESS)
+	if (VDO_ASSERT(thread_id < vdo->thread_config.thread_count,
+		       "thread_id %u (completion type %d) is less than thread count %u",
+		       thread_id, completion->type,
+		       vdo->thread_config.thread_count) != VDO_SUCCESS)
 		BUG();
 
 	completion->requeue = false;
drivers/md/dm-vdo/completion.h +3 -3
index aa145d73a686..3407f34ce58c 100644
@@ -85,9 +85,9 @@ static inline void vdo_fail_completion(struct vdo_completion *completion, int re
 static inline int vdo_assert_completion_type(struct vdo_completion *completion,
 					     enum vdo_completion_type expected)
 {
-	return ASSERT(expected == completion->type,
-		      "completion type should be %u, not %u", expected,
-		      completion->type);
+	return VDO_ASSERT(expected == completion->type,
+			  "completion type should be %u, not %u", expected,
+			  completion->type);
 }
 
 static inline void vdo_set_completion_callback(struct vdo_completion *completion,
drivers/md/dm-vdo/data-vio.c +54 -54

221 lines not on this page · raw message

drivers/md/dm-vdo/data-vio.h +34 -34

128 lines not on this page · raw message

drivers/md/dm-vdo/dedupe.c +82 -83

329 lines not on this page · raw message

drivers/md/dm-vdo/dm-vdo-target.c +19 -19
index 90ba379f8d3e..e493b2fec90b 100644
@@ -904,8 +904,8 @@ static int vdo_map_bio(struct dm_target *ti, struct bio *bio)
 	struct vdo_work_queue *current_work_queue;
 	const struct admin_state_code *code = vdo_get_admin_state_code(&vdo->admin.state);
 
-	ASSERT_LOG_ONLY(code->normal, "vdo should not receive bios while in state %s",
-			code->name);
+	VDO_ASSERT_LOG_ONLY(code->normal, "vdo should not receive bios while in state %s",
+			    code->name);
 
 	/* Count all incoming bios. */
 	vdo_count_bios(&vdo->stats.bios_in, bio);
@@ -1244,9 +1244,9 @@ static int perform_admin_operation(struct vdo *vdo, u32 starting_phase,
 /* Assert that we are operating on the correct thread for the current phase. */
 static void assert_admin_phase_thread(struct vdo *vdo, const char *what)
 {
-	ASSERT_LOG_ONLY(vdo_get_callback_thread_id() == get_thread_id_for_phase(vdo),
-			"%s on correct thread for %s", what,
-			ADMIN_PHASE_NAMES[vdo->admin.phase]);
+	VDO_ASSERT_LOG_ONLY(vdo_get_callback_thread_id() == get_thread_id_for_phase(vdo),
+			    "%s on correct thread for %s", what,
+			    ADMIN_PHASE_NAMES[vdo->admin.phase]);
 }
 
 /**
@@ -1424,11 +1424,11 @@ static void release_instance(unsigned int instance)
 {
 	mutex_lock(&instances_lock);
 	if (instance >= instances.bit_count) {
-		ASSERT_LOG_ONLY(false,
-				"instance number %u must be less than bit count %u",
-				instance, instances.bit_count);
+		VDO_ASSERT_LOG_ONLY(false,
+				    "instance number %u must be less than bit count %u",
+				    instance, instances.bit_count);
 	} else if (test_bit(instance, instances.words) == 0) {
-		ASSERT_LOG_ONLY(false, "instance number %u must be allocated", instance);
+		VDO_ASSERT_LOG_ONLY(false, "instance number %u must be allocated", instance);
 	} else {
 		__clear_bit(instance, instances.words);
 		instances.count -= 1;
@@ -1577,9 +1577,9 @@ static int allocate_instance(unsigned int *instance_ptr)
 	if (instance >= instances.bit_count) {
 		/* Nothing free after next, so wrap around to instance zero. */
 		instance = find_first_zero_bit(instances.words, instances.bit_count);
-		result = ASSERT(instance < instances.bit_count,
-				"impossibly, no zero bit found");
-		if (result != UDS_SUCCESS)
+		result = VDO_ASSERT(instance < instances.bit_count,
+				    "impossibly, no zero bit found");
+		if (result != VDO_SUCCESS)
 			return result;
 	}
 
@@ -1729,8 +1729,8 @@ static int prepare_to_grow_physical(struct vdo *vdo, block_count_t new_physical_
 
 	uds_log_info("Preparing to resize physical to %llu",
 		     (unsigned long long) new_physical_blocks);
-	ASSERT_LOG_ONLY((new_physical_blocks > current_physical_blocks),
-			"New physical size is larger than current physical size");
+	VDO_ASSERT_LOG_ONLY((new_physical_blocks > current_physical_blocks),
+			    "New physical size is larger than current physical size");
 	result = perform_admin_operation(vdo, PREPARE_GROW_PHYSICAL_PHASE_START,
 					 check_may_grow_physical,
 					 finish_operation_callback,
@@ -1829,8 +1829,8 @@ static int prepare_to_modify(struct dm_target *ti, struct device_config *config,
 
 		uds_log_info("Preparing to resize logical to %llu",
 			     (unsigned long long) config->logical_blocks);
-		ASSERT_LOG_ONLY((config->logical_blocks > logical_blocks),
-				"New logical size is larger than current size");
+		VDO_ASSERT_LOG_ONLY((config->logical_blocks > logical_blocks),
+				    "New logical size is larger than current size");
 
 		result = vdo_prepare_to_grow_block_map(vdo->block_map,
 						       config->logical_blocks);
@@ -2890,9 +2890,9 @@ static void vdo_module_destroy(void)
 	if (dm_registered)
 		dm_unregister_target(&vdo_target_bio);
 
-	ASSERT_LOG_ONLY(instances.count == 0,
-			"should have no instance numbers still in use, but have %u",
-			instances.count);
+	VDO_ASSERT_LOG_ONLY(instances.count == 0,
+			    "should have no instance numbers still in use, but have %u",
+			    instances.count);
 	vdo_free(instances.words);
 	memset(&instances, 0, sizeof(struct instance_tracker));
 
drivers/md/dm-vdo/encodings.c +78 -78

301 lines not on this page · raw message

drivers/md/dm-vdo/errors.c +3 -2
index df2498553312..3b5fddad8ddf 100644
@@ -281,8 +281,9 @@ int uds_register_error_block(const char *block_name, int first_error,
 		.infos = infos,
 	};
 
-	result = ASSERT(first_error < next_free_error, "well-defined error block range");
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(first_error < next_free_error,
+			    "well-defined error block range");
+	if (result != VDO_SUCCESS)
 		return result;
 
 	if (registered_errors.count == registered_errors.allocated) {
drivers/md/dm-vdo/flush.c +11 -11
index 8d8d9cf4a24c..e03679e4d1ba 100644
@@ -59,8 +59,8 @@ struct flusher {
  */
 static inline void assert_on_flusher_thread(struct flusher *flusher, const char *caller)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == flusher->thread_id),
-			"%s() called from flusher thread", caller);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == flusher->thread_id),
+			    "%s() called from flusher thread", caller);
 }
 
 /**
@@ -272,8 +272,8 @@ static void flush_vdo(struct vdo_completion *completion)
 	int result;
 
 	assert_on_flusher_thread(flusher, __func__);
-	result = ASSERT(vdo_is_state_normal(&flusher->state),
-			"flusher is in normal operation");
+	result = VDO_ASSERT(vdo_is_state_normal(&flusher->state),
+			    "flusher is in normal operation");
 	if (result != VDO_SUCCESS) {
 		vdo_enter_read_only_mode(flusher->vdo, result);
 		vdo_complete_flush(flush);
@@ -330,11 +330,11 @@ void vdo_complete_flushes(struct flusher *flusher)
 		if (flush->flush_generation >= oldest_active_generation)
 			return;
 
-		ASSERT_LOG_ONLY((flush->flush_generation ==
-				 flusher->first_unacknowledged_generation),
-				"acknowledged next expected flush, %llu, was: %llu",
-				(unsigned long long) flusher->first_unacknowledged_generation,
-				(unsigned long long) flush->flush_generation);
+		VDO_ASSERT_LOG_ONLY((flush->flush_generation ==
+				     flusher->first_unacknowledged_generation),
+				    "acknowledged next expected flush, %llu, was: %llu",
+				    (unsigned long long) flusher->first_unacknowledged_generation,
+				    (unsigned long long) flush->flush_generation);
 		vdo_waitq_dequeue_waiter(&flusher->pending_flushes);
 		vdo_complete_flush(flush);
 		flusher->first_unacknowledged_generation++;
@@ -400,8 +400,8 @@ void vdo_launch_flush(struct vdo *vdo, struct bio *bio)
 	struct flusher *flusher = vdo->flusher;
 	const struct admin_state_code *code = vdo_get_admin_state_code(&flusher->state);
 
-	ASSERT_LOG_ONLY(!code->quiescent, "Flushing not allowed in state %s",
-			code->name);
+	VDO_ASSERT_LOG_ONLY(!code->quiescent, "Flushing not allowed in state %s",
+			    code->name);
 
 	spin_lock(&flusher->lock);
 
drivers/md/dm-vdo/funnel-workqueue.c +11 -11
index a923432f0a37..03296e7fec12 100644
@@ -110,14 +110,14 @@ static struct vdo_completion *poll_for_completion(struct simple_work_queue *queu
 static void enqueue_work_queue_completion(struct simple_work_queue *queue,
 					  struct vdo_completion *completion)
 {
-	ASSERT_LOG_ONLY(completion->my_queue == NULL,
-			"completion %px (fn %px) to enqueue (%px) is not already queued (%px)",
-			completion, completion->callback, queue, completion->my_queue);
+	VDO_ASSERT_LOG_ONLY(completion->my_queue == NULL,
+			    "completion %px (fn %px) to enqueue (%px) is not already queued (%px)",
+			    completion, completion->callback, queue, completion->my_queue);
 	if (completion->priority == VDO_WORK_Q_DEFAULT_PRIORITY)
 		completion->priority = queue->common.type->default_priority;
 
-	if (ASSERT(completion->priority <= queue->common.type->max_priority,
-		   "priority is in range for queue") != VDO_SUCCESS)
+	if (VDO_ASSERT(completion->priority <= queue->common.type->max_priority,
+		       "priority is in range for queue") != VDO_SUCCESS)
 		completion->priority = 0;
 
 	completion->my_queue = &queue->common;
@@ -222,9 +222,9 @@ static struct vdo_completion *wait_for_next_completion(struct simple_work_queue
 static void process_completion(struct simple_work_queue *queue,
 			       struct vdo_completion *completion)
 {
-	if (ASSERT(completion->my_queue == &queue->common,
-		   "completion %px from queue %px marked as being in this queue (%px)",
-		   completion, queue, completion->my_queue) == UDS_SUCCESS)
+	if (VDO_ASSERT(completion->my_queue == &queue->common,
+		       "completion %px from queue %px marked as being in this queue (%px)",
+		       completion, queue, completion->my_queue) == VDO_SUCCESS)
 		completion->my_queue = NULL;
 
 	vdo_run_completion(completion);
@@ -319,9 +319,9 @@ static int make_simple_work_queue(const char *thread_name_prefix, const char *na
 	struct task_struct *thread = NULL;
 	int result;
 
-	ASSERT_LOG_ONLY((type->max_priority <= VDO_WORK_Q_MAX_PRIORITY),
-			"queue priority count %u within limit %u", type->max_priority,
-			VDO_WORK_Q_MAX_PRIORITY);
+	VDO_ASSERT_LOG_ONLY((type->max_priority <= VDO_WORK_Q_MAX_PRIORITY),
+			    "queue priority count %u within limit %u", type->max_priority,
+			    VDO_WORK_Q_MAX_PRIORITY);
 
 	result = vdo_allocate(1, struct simple_work_queue, "simple work queue", &queue);
 	if (result != VDO_SUCCESS)
drivers/md/dm-vdo/io-submitter.c +4 -4
index e82b4a8c6fc4..61bb48068c3a 100644
@@ -94,7 +94,7 @@ static void count_all_bios(struct vio *vio, struct bio *bio)
  */
 static void assert_in_bio_zone(struct vio *vio)
 {
-	ASSERT_LOG_ONLY(!in_interrupt(), "not in interrupt context");
+	VDO_ASSERT_LOG_ONLY(!in_interrupt(), "not in interrupt context");
 	assert_vio_in_bio_zone(vio);
 }
 
@@ -300,7 +300,7 @@ static bool try_bio_map_merge(struct vio *vio)
 	mutex_unlock(&bio_queue_data->lock);
 
 	/* We don't care about failure of int_map_put in this case. */
-	ASSERT_LOG_ONLY(result == VDO_SUCCESS, "bio map insertion succeeds");
+	VDO_ASSERT_LOG_ONLY(result == VDO_SUCCESS, "bio map insertion succeeds");
 	return merged;
 }
 
@@ -345,8 +345,8 @@ void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
 	const struct admin_state_code *code = vdo_get_admin_state(completion->vdo);
 
 
-	ASSERT_LOG_ONLY(!code->quiescent, "I/O not allowed in state %s", code->name);
-	ASSERT_LOG_ONLY(vio->bio->bi_next == NULL, "metadata bio has no next bio");
+	VDO_ASSERT_LOG_ONLY(!code->quiescent, "I/O not allowed in state %s", code->name);
+	VDO_ASSERT_LOG_ONLY(vio->bio->bi_next == NULL, "metadata bio has no next bio");
 
 	vdo_reset_completion(completion);
 	completion->error_handler = error_handler;
drivers/md/dm-vdo/logical-zone.c +11 -11
index ca5bc3be7978..300f9d2d2d5c 100644
@@ -142,8 +142,8 @@ void vdo_free_logical_zones(struct logical_zones *zones)
 
 static inline void assert_on_zone_thread(struct logical_zone *zone, const char *what)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == zone->thread_id),
-			"%s() called on correct thread", what);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == zone->thread_id),
+			    "%s() called on correct thread", what);
 }
 
 /**
@@ -247,10 +247,10 @@ void vdo_increment_logical_zone_flush_generation(struct logical_zone *zone,
 						 sequence_number_t expected_generation)
 {
 	assert_on_zone_thread(zone, __func__);
-	ASSERT_LOG_ONLY((zone->flush_generation == expected_generation),
-			"logical zone %u flush generation %llu should be %llu before increment",
-			zone->zone_number, (unsigned long long) zone->flush_generation,
-			(unsigned long long) expected_generation);
+	VDO_ASSERT_LOG_ONLY((zone->flush_generation == expected_generation),
+			    "logical zone %u flush generation %llu should be %llu before increment",
+			    zone->zone_number, (unsigned long long) zone->flush_generation,
+			    (unsigned long long) expected_generation);
 
 	zone->flush_generation++;
 	zone->ios_in_flush_generation = 0;
@@ -267,7 +267,7 @@ void vdo_acquire_flush_generation_lock(struct data_vio *data_vio)
 	struct logical_zone *zone = data_vio->logical.zone;
 
 	assert_on_zone_thread(zone, __func__);
-	ASSERT_LOG_ONLY(vdo_is_state_normal(&zone->state), "vdo state is normal");
+	VDO_ASSERT_LOG_ONLY(vdo_is_state_normal(&zone->state), "vdo state is normal");
 
 	data_vio->flush_generation = zone->flush_generation;
 	list_add_tail(&data_vio->write_entry, &zone->write_vios);
@@ -332,10 +332,10 @@ void vdo_release_flush_generation_lock(struct data_vio *data_vio)
 		return;
 
 	list_del_init(&data_vio->write_entry);
-	ASSERT_LOG_ONLY((zone->oldest_active_generation <= data_vio->flush_generation),
-			"data_vio releasing lock on generation %llu is not older than oldest active generation %llu",
-			(unsigned long long) data_vio->flush_generation,
-			(unsigned long long) zone->oldest_active_generation);
+	VDO_ASSERT_LOG_ONLY((zone->oldest_active_generation <= data_vio->flush_generation),
+			    "data_vio releasing lock on generation %llu is not older than oldest active generation %llu",
+			    (unsigned long long) data_vio->flush_generation,
+			    (unsigned long long) zone->oldest_active_generation);
 
 	if (!update_oldest_active_generation(zone) || zone->notifying)
 		return;
drivers/md/dm-vdo/memory-alloc.c +6 -6
index dd5acc582fb3..62bb717c4c50 100644
@@ -385,12 +385,12 @@ void vdo_memory_init(void)
 
 void vdo_memory_exit(void)
 {
-	ASSERT_LOG_ONLY(memory_stats.kmalloc_bytes == 0,
-			"kmalloc memory used (%zd bytes in %zd blocks) is returned to the kernel",
-			memory_stats.kmalloc_bytes, memory_stats.kmalloc_blocks);
-	ASSERT_LOG_ONLY(memory_stats.vmalloc_bytes == 0,
-			"vmalloc memory used (%zd bytes in %zd blocks) is returned to the kernel",
-			memory_stats.vmalloc_bytes, memory_stats.vmalloc_blocks);
+	VDO_ASSERT_LOG_ONLY(memory_stats.kmalloc_bytes == 0,
+			    "kmalloc memory used (%zd bytes in %zd blocks) is returned to the kernel",
+			    memory_stats.kmalloc_bytes, memory_stats.kmalloc_blocks);
+	VDO_ASSERT_LOG_ONLY(memory_stats.vmalloc_bytes == 0,
+			    "vmalloc memory used (%zd bytes in %zd blocks) is returned to the kernel",
+			    memory_stats.vmalloc_bytes, memory_stats.vmalloc_blocks);
 	uds_log_debug("peak usage %zd bytes", memory_stats.peak_bytes);
 }
 
drivers/md/dm-vdo/packer.c +6 -6
index 5774d8fd5c5a..4d45243161a6 100644
@@ -86,8 +86,8 @@ int vdo_get_compressed_block_fragment(enum block_mapping_state mapping_state,
  */
 static inline void assert_on_packer_thread(struct packer *packer, const char *caller)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == packer->thread_id),
-			"%s() called from packer thread", caller);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == packer->thread_id),
+			    "%s() called from packer thread", caller);
 }
 
 /**
@@ -569,9 +569,9 @@ void vdo_attempt_packing(struct data_vio *data_vio)
 
 	assert_on_packer_thread(packer, __func__);
 
-	result = ASSERT((status.stage == DATA_VIO_COMPRESSING),
-			"attempt to pack data_vio not ready for packing, stage: %u",
-			status.stage);
+	result = VDO_ASSERT((status.stage == DATA_VIO_COMPRESSING),
+			    "attempt to pack data_vio not ready for packing, stage: %u",
+			    status.stage);
 	if (result != VDO_SUCCESS)
 		return;
 
@@ -671,7 +671,7 @@ void vdo_remove_lock_holder_from_packer(struct vdo_completion *completion)
 
 	lock_holder = vdo_forget(data_vio->compression.lock_holder);
 	bin = lock_holder->compression.bin;
-	ASSERT_LOG_ONLY((bin != NULL), "data_vio in packer has a bin");
+	VDO_ASSERT_LOG_ONLY((bin != NULL), "data_vio in packer has a bin");
 
 	slot = lock_holder->compression.slot;
 	bin->slots_used--;
drivers/md/dm-vdo/permassert.h +9 -6
index ee978bc115ec..8774dde7927a 100644
@@ -13,7 +13,6 @@
 /* Utilities for asserting that certain conditions are met */
 
 #define STRINGIFY(X) #X
-#define STRINGIFY_VALUE(X) STRINGIFY(X)
 
 /*
  * A hack to apply the "warn if unused" attribute to an integral expression.
@@ -23,19 +22,23 @@
  * expression. With optimization enabled, this function contributes no additional instructions, but
  * the warn_unused_result attribute still applies to the code calling it.
  */
-static inline int __must_check uds_must_use(int value)
+static inline int __must_check vdo_must_use(int value)
 {
 	return value;
 }
 
 /* Assert that an expression is true and return an error if it is not. */
-#define ASSERT(expr, ...) uds_must_use(__UDS_ASSERT(expr, __VA_ARGS__))
+#define VDO_ASSERT(expr, ...) vdo_must_use(__VDO_ASSERT(expr, __VA_ARGS__))
 
 /* Log a message if the expression is not true. */
-#define ASSERT_LOG_ONLY(expr, ...) __UDS_ASSERT(expr, __VA_ARGS__)
+#define VDO_ASSERT_LOG_ONLY(expr, ...) __VDO_ASSERT(expr, __VA_ARGS__)
 
-#define __UDS_ASSERT(expr, ...)				      \
-	(likely(expr) ? UDS_SUCCESS			      \
+/* For use by UDS */
+#define ASSERT(expr, ...) VDO_ASSERT(expr, __VA_ARGS__)
+#define ASSERT_LOG_ONLY(expr, ...) __VDO_ASSERT(expr, __VA_ARGS__)
+
+#define __VDO_ASSERT(expr, ...)				      \
+	(likely(expr) ? VDO_SUCCESS			      \
 		      : uds_assertion_failed(STRINGIFY(expr), __FILE__, __LINE__, __VA_ARGS__))
 
 /* Log an assertion failure message. */
drivers/md/dm-vdo/physical-zone.c +24 -24

108 lines not on this page · raw message

drivers/md/dm-vdo/priority-table.c +2 -2
index fc99268d2437..42d3d8d0e4b5 100644
@@ -127,8 +127,8 @@ void vdo_reset_priority_table(struct priority_table *table)
 void vdo_priority_table_enqueue(struct priority_table *table, unsigned int priority,
 				struct list_head *entry)
 {
-	ASSERT_LOG_ONLY((priority <= table->max_priority),
-			"entry priority must be valid for the table");
+	VDO_ASSERT_LOG_ONLY((priority <= table->max_priority),
+			    "entry priority must be valid for the table");
 
 	/* Append the entry to the queue in the specified bucket. */
 	list_move_tail(entry, &table->buckets[priority].queue);
drivers/md/dm-vdo/recovery-journal.c +30 -30

126 lines not on this page · raw message

drivers/md/dm-vdo/repair.c +6 -6
index bfcdedeedb86..c7abb8078336 100644
@@ -976,8 +976,8 @@ find_entry_starting_next_page(struct repair_completion *repair,
 		if (needs_sort) {
 			struct numbered_block_mapping *just_sorted_entry =
 				sort_next_heap_element(repair);
-			ASSERT_LOG_ONLY(just_sorted_entry < current_entry,
-					"heap is returning elements in an unexpected order");
+			VDO_ASSERT_LOG_ONLY(just_sorted_entry < current_entry,
+					    "heap is returning elements in an unexpected order");
 		}
 
 		current_entry--;
@@ -1129,8 +1129,8 @@ static void recover_block_map(struct vdo_completion *completion)
 
 	repair->current_entry = &repair->entries[repair->block_map_entry_count - 1];
 	first_sorted_entry = sort_next_heap_element(repair);
-	ASSERT_LOG_ONLY(first_sorted_entry == repair->current_entry,
-			"heap is returning elements in an unexpected order");
+	VDO_ASSERT_LOG_ONLY(first_sorted_entry == repair->current_entry,
+			    "heap is returning elements in an unexpected order");
 
 	/* Prevent any page from being processed until all pages have been launched. */
 	repair->launching = true;
@@ -1489,8 +1489,8 @@ static int extract_new_mappings(struct repair_completion *repair)
 		repair->block_map_entry_count++;
 	}
 
-	result = ASSERT((repair->block_map_entry_count <= repair->entry_count),
-			"approximate entry count is an upper bound");
+	result = VDO_ASSERT((repair->block_map_entry_count <= repair->entry_count),
+			    "approximate entry count is an upper bound");
 	if (result != VDO_SUCCESS)
 		vdo_enter_read_only_mode(vdo, result);
 
drivers/md/dm-vdo/slab-depot.c +58 -58

261 lines not on this page · raw message

drivers/md/dm-vdo/thread-registry.c +2 -2
index 03e2f45e8e78..d4a077d58c60 100644
@@ -44,7 +44,7 @@ void vdo_register_thread(struct thread_registry *registry,
 	list_add_tail_rcu(&new_thread->links, &registry->links);
 	spin_unlock(&registry->lock);
 
-	ASSERT_LOG_ONLY(!found_it, "new thread not already in registry");
+	VDO_ASSERT_LOG_ONLY(!found_it, "new thread not already in registry");
 	if (found_it) {
 		/* Ensure no RCU iterators see it before re-initializing. */
 		synchronize_rcu();
@@ -67,7 +67,7 @@ void vdo_unregister_thread(struct thread_registry *registry)
 	}
 	spin_unlock(&registry->lock);
 
-	ASSERT_LOG_ONLY(found_it, "thread found in registry");
+	VDO_ASSERT_LOG_ONLY(found_it, "thread found in registry");
 	if (found_it) {
 		/* Ensure no RCU iterators see it before re-initializing. */
 		synchronize_rcu();
drivers/md/dm-vdo/vdo.c +16 -16
index b4dd0634a5cb..11be2ab17e29 100644
@@ -425,9 +425,9 @@ int vdo_make_thread(struct vdo *vdo, thread_id_t thread_id,
 		type = &default_queue_type;
 
 	if (thread->queue != NULL) {
-		return ASSERT(vdo_work_queue_type_is(thread->queue, type),
-			      "already constructed vdo thread %u is of the correct type",
-			      thread_id);
+		return VDO_ASSERT(vdo_work_queue_type_is(thread->queue, type),
+				  "already constructed vdo thread %u is of the correct type",
+				  thread_id);
 	}
 
 	thread->vdo = vdo;
@@ -448,8 +448,8 @@ static int register_vdo(struct vdo *vdo)
 	int result;
 
 	write_lock(&registry.lock);
-	result = ASSERT(filter_vdos_locked(vdo_is_equal, vdo) == NULL,
-			"VDO not already registered");
+	result = VDO_ASSERT(filter_vdos_locked(vdo_is_equal, vdo) == NULL,
+			    "VDO not already registered");
 	if (result == VDO_SUCCESS) {
 		INIT_LIST_HEAD(&vdo->registration);
 		list_add_tail(&vdo->registration, &registry.links);
@@ -1050,8 +1050,8 @@ int vdo_register_read_only_listener(struct vdo *vdo, void *listener,
 	struct read_only_listener *read_only_listener;
 	int result;
 
-	result = ASSERT(thread_id != vdo->thread_config.dedupe_thread,
-			"read only listener not registered on dedupe thread");
+	result = VDO_ASSERT(thread_id != vdo->thread_config.dedupe_thread,
+			    "read only listener not registered on dedupe thread");
 	if (result != VDO_SUCCESS)
 		return result;
 
@@ -1704,8 +1704,8 @@ void vdo_dump_status(const struct vdo *vdo)
  */
 void vdo_assert_on_admin_thread(const struct vdo *vdo, const char *name)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == vdo->thread_config.admin_thread),
-			"%s called on admin thread", name);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() == vdo->thread_config.admin_thread),
+			    "%s called on admin thread", name);
 }
 
 /**
@@ -1718,9 +1718,9 @@ void vdo_assert_on_admin_thread(const struct vdo *vdo, const char *name)
 void vdo_assert_on_logical_zone_thread(const struct vdo *vdo, zone_count_t logical_zone,
 				       const char *name)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() ==
-			 vdo->thread_config.logical_threads[logical_zone]),
-			"%s called on logical thread", name);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() ==
+			     vdo->thread_config.logical_threads[logical_zone]),
+			    "%s called on logical thread", name);
 }
 
 /**
@@ -1733,9 +1733,9 @@ void vdo_assert_on_logical_zone_thread(const struct vdo *vdo, zone_count_t logic
 void vdo_assert_on_physical_zone_thread(const struct vdo *vdo,
 					zone_count_t physical_zone, const char *name)
 {
-	ASSERT_LOG_ONLY((vdo_get_callback_thread_id() ==
-			 vdo->thread_config.physical_threads[physical_zone]),
-			"%s called on physical thread", name);
+	VDO_ASSERT_LOG_ONLY((vdo_get_callback_thread_id() ==
+			     vdo->thread_config.physical_threads[physical_zone]),
+			    "%s called on physical thread", name);
 }
 
 /**
@@ -1773,7 +1773,7 @@ int vdo_get_physical_zone(const struct vdo *vdo, physical_block_number_t pbn,
 
 	/* With the PBN already checked, we should always succeed in finding a slab. */
 	slab = vdo_get_slab(vdo->depot, pbn);
-	result = ASSERT(slab != NULL, "vdo_get_slab must succeed on all valid PBNs");
+	result = VDO_ASSERT(slab != NULL, "vdo_get_slab must succeed on all valid PBNs");
 	if (result != VDO_SUCCESS)
 		return result;
 
drivers/md/dm-vdo/vio.c +20 -20
index 83c36f7590de..b1e4e604c2c3 100644
@@ -82,14 +82,14 @@ int allocate_vio_components(struct vdo *vdo, enum vio_type vio_type,
 	struct bio *bio;
 	int result;
 
-	result = ASSERT(block_count <= MAX_BLOCKS_PER_VIO,
-			"block count %u does not exceed maximum %u", block_count,
-			MAX_BLOCKS_PER_VIO);
+	result = VDO_ASSERT(block_count <= MAX_BLOCKS_PER_VIO,
+			    "block count %u does not exceed maximum %u", block_count,
+			    MAX_BLOCKS_PER_VIO);
 	if (result != VDO_SUCCESS)
 		return result;
 
-	result = ASSERT(((vio_type != VIO_TYPE_UNINITIALIZED) && (vio_type != VIO_TYPE_DATA)),
-			"%d is a metadata type", vio_type);
+	result = VDO_ASSERT(((vio_type != VIO_TYPE_UNINITIALIZED) && (vio_type != VIO_TYPE_DATA)),
+			    "%d is a metadata type", vio_type);
 	if (result != VDO_SUCCESS)
 		return result;
 
@@ -363,13 +363,13 @@ void free_vio_pool(struct vio_pool *pool)
 		return;
 
 	/* Remove all available vios from the object pool. */
-	ASSERT_LOG_ONLY(!vdo_waitq_has_waiters(&pool->waiting),
-			"VIO pool must not have any waiters when being freed");
-	ASSERT_LOG_ONLY((pool->busy_count == 0),
-			"VIO pool must not have %zu busy entries when being freed",
-			pool->busy_count);
-	ASSERT_LOG_ONLY(list_empty(&pool->busy),
-			"VIO pool must not have busy entries when being freed");
+	VDO_ASSERT_LOG_ONLY(!vdo_waitq_has_waiters(&pool->waiting),
+			    "VIO pool must not have any waiters when being freed");
+	VDO_ASSERT_LOG_ONLY((pool->busy_count == 0),
+			    "VIO pool must not have %zu busy entries when being freed",
+			    pool->busy_count);
+	VDO_ASSERT_LOG_ONLY(list_empty(&pool->busy),
+			    "VIO pool must not have busy entries when being freed");
 
 	list_for_each_entry_safe(pooled, tmp, &pool->available, pool_entry) {
 		list_del(&pooled->pool_entry);
@@ -377,8 +377,8 @@ void free_vio_pool(struct vio_pool *pool)
 		pool->size--;
 	}
 
-	ASSERT_LOG_ONLY(pool->size == 0,
-			"VIO pool must not have missing entries when being freed");
+	VDO_ASSERT_LOG_ONLY(pool->size == 0,
+			    "VIO pool must not have missing entries when being freed");
 
 	vdo_free(vdo_forget(pool->buffer));
 	vdo_free(pool);
@@ -403,8 +403,8 @@ void acquire_vio_from_pool(struct vio_pool *pool, struct vdo_waiter *waiter)
 {
 	struct pooled_vio *pooled;
 
-	ASSERT_LOG_ONLY((pool->thread_id == vdo_get_callback_thread_id()),
-			"acquire from active vio_pool called from correct thread");
+	VDO_ASSERT_LOG_ONLY((pool->thread_id == vdo_get_callback_thread_id()),
+			    "acquire from active vio_pool called from correct thread");
 
 	if (list_empty(&pool->available)) {
 		vdo_waitq_enqueue_waiter(&pool->waiting, waiter);
@@ -424,8 +424,8 @@ void acquire_vio_from_pool(struct vio_pool *pool, struct vdo_waiter *waiter)
  */
 void return_vio_to_pool(struct vio_pool *pool, struct pooled_vio *vio)
 {
-	ASSERT_LOG_ONLY((pool->thread_id == vdo_get_callback_thread_id()),
-			"vio pool entry returned on same thread as it was acquired");
+	VDO_ASSERT_LOG_ONLY((pool->thread_id == vdo_get_callback_thread_id()),
+			    "vio pool entry returned on same thread as it was acquired");
 
 	vio->vio.completion.error_handler = NULL;
 	vio->vio.completion.parent = NULL;
@@ -465,8 +465,8 @@ void vdo_count_bios(struct atomic_bio_stats *bio_stats, struct bio *bio)
 		 * shouldn't exist.
 		 */
 	default:
-		ASSERT_LOG_ONLY(0, "Bio operation %d not a write, read, discard, or empty flush",
-				bio_op(bio));
+		VDO_ASSERT_LOG_ONLY(0, "Bio operation %d not a write, read, discard, or empty flush",
+				    bio_op(bio));
 	}
 
 	if ((bio->bi_opf & REQ_PREFLUSH) != 0)
drivers/md/dm-vdo/vio.h +4 -4
index fbfee5e3415d..3490e9f59b04 100644
@@ -67,10 +67,10 @@ static inline void assert_vio_in_bio_zone(struct vio *vio)
 	thread_id_t expected = get_vio_bio_zone_thread_id(vio);
 	thread_id_t thread_id = vdo_get_callback_thread_id();
 
-	ASSERT_LOG_ONLY((expected == thread_id),
-			"vio I/O for physical block %llu on thread %u, should be on bio zone thread %u",
-			(unsigned long long) pbn_from_vio_bio(vio->bio), thread_id,
-			expected);
+	VDO_ASSERT_LOG_ONLY((expected == thread_id),
+			    "vio I/O for physical block %llu on thread %u, should be on bio zone thread %u",
+			    (unsigned long long) pbn_from_vio_bio(vio->bio), thread_id,
+			    expected);
 }
 
 int vdo_create_bio(struct bio **bio_ptr);
Signature · 1 line
2.42.0
author maintainer
#8 lore raw

PATCH 8/10 dm vdo encodings: update some stale comments

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

---
 drivers/md/dm-vdo/encodings.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/md/dm-vdo/encodings.c +1 -3
index e24c31bc3524..ebb0a4edd109 100644
@@ -544,8 +544,6 @@ const char *vdo_get_journal_operation_name(enum journal_operation operation)
 
 /**
  * encode_slab_depot_state_2_0() - Encode the state of a slab depot into a buffer.
- *
- * Return: UDS_SUCCESS or an error.
  */
 static void encode_slab_depot_state_2_0(u8 *buffer, size_t *offset,
 					struct slab_depot_state_2_0 state)
@@ -573,7 +571,7 @@ static void encode_slab_depot_state_2_0(u8 *buffer, size_t *offset,
 /**
  * decode_slab_depot_state_2_0() - Decode slab depot component state version 2.0 from a buffer.
  *
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
  */
 static int decode_slab_depot_state_2_0(u8 *buffer, size_t *offset,
 				       struct slab_depot_state_2_0 *state)
Signature · 1 line
2.42.0
author maintainer
#9 lore raw

PATCH 9/10 dm vdo indexer: update ASSERT and ASSERT_LOG_ONLY usage

In reply to Matthew Sakai

Update indexer uses of ASSERT and ASSERT_LOG_ONLY to VDO_ASSERT and VDO_ASSERT_LOG_ONLY, respectively. Remove ASSERT and ASSERT_LOG_ONLY. Also rename uds_assertion_failed to vdo_assertion_failed.

---
 drivers/md/dm-vdo/indexer/chapter-index.c | 16 ++--
 drivers/md/dm-vdo/indexer/config.c        | 16 ++--
 drivers/md/dm-vdo/indexer/delta-index.c   | 90 +++++++++++------------
 drivers/md/dm-vdo/indexer/index-layout.c  |  5 +-
 drivers/md/dm-vdo/indexer/index-session.c | 12 +--
 drivers/md/dm-vdo/indexer/index.c         |  4 +-
 drivers/md/dm-vdo/indexer/volume-index.c  | 32 ++++----
 drivers/md/dm-vdo/indexer/volume.c        | 32 ++++----
 drivers/md/dm-vdo/permassert.c            |  2 +-
 drivers/md/dm-vdo/permassert.h            |  8 +-
 10 files changed, 107 insertions(+), 110 deletions(-)
drivers/md/dm-vdo/indexer/chapter-index.c +8 -8
index 68d86028dbb7..47e4ed234242 100644
@@ -83,10 +83,10 @@ int uds_put_open_chapter_index_record(struct open_chapter_index *chapter_index,
 	u64 chapter_number = chapter_index->virtual_chapter_number;
 	u32 record_pages = geometry->record_pages_per_chapter;
 
-	result = ASSERT(page_number < record_pages,
-			"Page number within chapter (%u) exceeds the maximum value %u",
-			page_number, record_pages);
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(page_number < record_pages,
+			    "Page number within chapter (%u) exceeds the maximum value %u",
+			    page_number, record_pages);
+	if (result != VDO_SUCCESS)
 		return UDS_INVALID_ARGUMENT;
 
 	address = uds_hash_to_chapter_delta_address(name, geometry);
@@ -97,10 +97,10 @@ int uds_put_open_chapter_index_record(struct open_chapter_index *chapter_index,
 		return result;
 
 	found = was_entry_found(&entry, address);
-	result = ASSERT(!(found && entry.is_collision),
-			"Chunk appears more than once in chapter %llu",
-			(unsigned long long) chapter_number);
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(!(found && entry.is_collision),
+			    "Chunk appears more than once in chapter %llu",
+			    (unsigned long long) chapter_number);
+	if (result != VDO_SUCCESS)
 		return UDS_BAD_STATE;
 
 	found_name = (found ? name->name : NULL);
drivers/md/dm-vdo/indexer/config.c +8 -8
index 5da39043b9ae..69bf27a9d61b 100644
@@ -134,10 +134,10 @@ int uds_validate_config_contents(struct buffered_reader *reader,
 	decode_u32_le(buffer, &offset, &config.sparse_sample_rate);
 	decode_u64_le(buffer, &offset, &config.nonce);
 
-	result = ASSERT(offset == sizeof(struct uds_configuration_6_02),
-			"%zu bytes read but not decoded",
-			sizeof(struct uds_configuration_6_02) - offset);
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(offset == sizeof(struct uds_configuration_6_02),
+			    "%zu bytes read but not decoded",
+			    sizeof(struct uds_configuration_6_02) - offset);
+	if (result != VDO_SUCCESS)
 		return UDS_CORRUPT_DATA;
 
 	if (is_version(INDEX_CONFIG_VERSION_6_02, version_buffer)) {
@@ -210,10 +210,10 @@ int uds_write_config_contents(struct buffered_writer *writer,
 	encode_u32_le(buffer, &offset, config->sparse_sample_rate);
 	encode_u64_le(buffer, &offset, config->nonce);
 
-	result = ASSERT(offset == sizeof(struct uds_configuration_6_02),
-			"%zu bytes encoded, of %zu expected", offset,
-			sizeof(struct uds_configuration_6_02));
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(offset == sizeof(struct uds_configuration_6_02),
+			    "%zu bytes encoded, of %zu expected", offset,
+			    sizeof(struct uds_configuration_6_02));
+	if (result != VDO_SUCCESS)
 		return result;
 
 	if (version >= 4) {
drivers/md/dm-vdo/indexer/delta-index.c +45 -45

169 lines not on this page · raw message

drivers/md/dm-vdo/indexer/index-layout.c +3 -2
index 01e0db4184aa..349b3022f1e1 100644
@@ -837,8 +837,9 @@ static u64 generate_index_save_nonce(u64 volume_nonce, struct index_save_layout
 	encode_u32_le(buffer, &offset, isl->save_data.version);
 	encode_u32_le(buffer, &offset, 0U);
 	encode_u64_le(buffer, &offset, isl->index_save.start_block);
-	ASSERT_LOG_ONLY(offset == sizeof(nonce_data),
-			"%zu bytes encoded of %zu expected", offset, sizeof(nonce_data));
+	VDO_ASSERT_LOG_ONLY(offset == sizeof(nonce_data),
+			    "%zu bytes encoded of %zu expected",
+			    offset, sizeof(nonce_data));
 	return generate_secondary_nonce(volume_nonce, buffer, sizeof(buffer));
 }
 
drivers/md/dm-vdo/indexer/index-session.c +6 -6
index 22445dcb3fe0..9eae00548095 100644
@@ -199,8 +199,8 @@ static void update_session_stats(struct uds_request *request)
 		break;
 
 	default:
-		request->status = ASSERT(false, "unknown request type: %d",
-					 request->type);
+		request->status = VDO_ASSERT(false, "unknown request type: %d",
+					     request->type);
 	}
 }
 
@@ -402,8 +402,8 @@ static void suspend_rebuild(struct uds_index_session *session)
 	case INDEX_FREEING:
 	default:
 		/* These cases should not happen. */
-		ASSERT_LOG_ONLY(false, "Bad load context state %u",
-				session->load_context.status);
+		VDO_ASSERT_LOG_ONLY(false, "Bad load context state %u",
+				    session->load_context.status);
 		break;
 	}
 	mutex_unlock(&session->load_context.mutex);
@@ -531,8 +531,8 @@ int uds_resume_index_session(struct uds_index_session *session,
 		case INDEX_FREEING:
 		default:
 			/* These cases should not happen; do nothing. */
-			ASSERT_LOG_ONLY(false, "Bad load context state %u",
-					session->load_context.status);
+			VDO_ASSERT_LOG_ONLY(false, "Bad load context state %u",
+					    session->load_context.status);
 			break;
 		}
 		mutex_unlock(&session->load_context.mutex);
drivers/md/dm-vdo/indexer/index.c +2 -2
index 226713221105..221af95ca2a4 100644
@@ -112,7 +112,7 @@ static void enqueue_barrier_messages(struct uds_index *index, u64 virtual_chapte
 	for (zone = 0; zone < index->zone_count; zone++) {
 		int result = launch_zone_message(message, zone, index);
 
-		ASSERT_LOG_ONLY((result == UDS_SUCCESS), "barrier message allocation");
+		VDO_ASSERT_LOG_ONLY((result == UDS_SUCCESS), "barrier message allocation");
 	}
 }
 
@@ -1380,7 +1380,7 @@ void uds_enqueue_request(struct uds_request *request, enum request_stage stage)
 		break;
 
 	default:
-		ASSERT_LOG_ONLY(false, "invalid index stage: %d", stage);
+		VDO_ASSERT_LOG_ONLY(false, "invalid index stage: %d", stage);
 		return;
 	}
 
drivers/md/dm-vdo/indexer/volume-index.c +16 -16
index 1cc9ac4fe510..e2b0600d82b9 100644
@@ -832,10 +832,10 @@ static int start_restoring_volume_sub_index(struct volume_sub_index *sub_index,
 		decode_u32_le(buffer, &offset, &header.first_list);
 		decode_u32_le(buffer, &offset, &header.list_count);
 
-		result = ASSERT(offset == sizeof(buffer),
-				"%zu bytes decoded of %zu expected", offset,
-				sizeof(buffer));
-		if (result != UDS_SUCCESS)
+		result = VDO_ASSERT(offset == sizeof(buffer),
+				    "%zu bytes decoded of %zu expected", offset,
+				    sizeof(buffer));
+		if (result != VDO_SUCCESS)
 			result = UDS_CORRUPT_DATA;
 
 		if (memcmp(header.magic, MAGIC_START_5, MAGIC_SIZE) != 0) {
@@ -924,10 +924,10 @@ static int start_restoring_volume_index(struct volume_index *volume_index,
 		offset += MAGIC_SIZE;
 		decode_u32_le(buffer, &offset, &header.sparse_sample_rate);
 
-		result = ASSERT(offset == sizeof(buffer),
-				"%zu bytes decoded of %zu expected", offset,
-				sizeof(buffer));
-		if (result != UDS_SUCCESS)
+		result = VDO_ASSERT(offset == sizeof(buffer),
+				    "%zu bytes decoded of %zu expected", offset,
+				    sizeof(buffer));
+		if (result != VDO_SUCCESS)
 			result = UDS_CORRUPT_DATA;
 
 		if (memcmp(header.magic, MAGIC_START_6, MAGIC_SIZE) != 0)
@@ -1023,10 +1023,10 @@ static int start_saving_volume_sub_index(const struct volume_sub_index *sub_inde
 	encode_u32_le(buffer, &offset, first_list);
 	encode_u32_le(buffer, &offset, list_count);
 
-	result =  ASSERT(offset == sizeof(struct sub_index_data),
-			 "%zu bytes of config written, of %zu expected", offset,
-			 sizeof(struct sub_index_data));
-	if (result != UDS_SUCCESS)
+	result =  VDO_ASSERT(offset == sizeof(struct sub_index_data),
+			     "%zu bytes of config written, of %zu expected", offset,
+			     sizeof(struct sub_index_data));
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_write_to_buffered_writer(buffered_writer, buffer, offset);
@@ -1066,10 +1066,10 @@ static int start_saving_volume_index(const struct volume_index *volume_index,
 	memcpy(buffer, MAGIC_START_6, MAGIC_SIZE);
 	offset += MAGIC_SIZE;
 	encode_u32_le(buffer, &offset, volume_index->sparse_sample_rate);
-	result = ASSERT(offset == sizeof(struct volume_index_data),
-			"%zu bytes of header written, of %zu expected", offset,
-			sizeof(struct volume_index_data));
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(offset == sizeof(struct volume_index_data),
+			    "%zu bytes of header written, of %zu expected", offset,
+			    sizeof(struct volume_index_data));
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = uds_write_to_buffered_writer(writer, buffer, offset);
drivers/md/dm-vdo/indexer/volume.c +16 -16
index 0a4beef8ac8d..701f2220d803 100644
@@ -135,8 +135,8 @@ static void begin_pending_search(struct page_cache *cache, u32 physical_page,
 	invalidate_counter.page = physical_page;
 	invalidate_counter.counter++;
 	set_invalidate_counter(cache, zone_number, invalidate_counter);
-	ASSERT_LOG_ONLY(search_pending(invalidate_counter),
-			"Search is pending for zone %u", zone_number);
+	VDO_ASSERT_LOG_ONLY(search_pending(invalidate_counter),
+			    "Search is pending for zone %u", zone_number);
 	/*
 	 * This memory barrier ensures that the write to the invalidate counter is seen by other
 	 * threads before this thread accesses the cached page. The corresponding read memory
@@ -158,8 +158,8 @@ static void end_pending_search(struct page_cache *cache, unsigned int zone_numbe
 	smp_mb();
 
 	invalidate_counter = get_invalidate_counter(cache, zone_number);
-	ASSERT_LOG_ONLY(search_pending(invalidate_counter),
-			"Search is pending for zone %u", zone_number);
+	VDO_ASSERT_LOG_ONLY(search_pending(invalidate_counter),
+			    "Search is pending for zone %u", zone_number);
 	invalidate_counter.counter++;
 	set_invalidate_counter(cache, zone_number, invalidate_counter);
 }
@@ -259,8 +259,8 @@ static int put_page_in_cache(struct page_cache *cache, u32 physical_page,
 	int result;
 
 	/* We hold the read_threads_mutex. */
-	result = ASSERT((page->read_pending), "page to install has a pending read");
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT((page->read_pending), "page to install has a pending read");
+	if (result != VDO_SUCCESS)
 		return result;
 
 	page->physical_page = physical_page;
@@ -285,8 +285,8 @@ static void cancel_page_in_cache(struct page_cache *cache, u32 physical_page,
 	int result;
 
 	/* We hold the read_threads_mutex. */
-	result = ASSERT((page->read_pending), "page to install has a pending read");
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT((page->read_pending), "page to install has a pending read");
+	if (result != VDO_SUCCESS)
 		return;
 
 	clear_cache_page(cache, page);
@@ -889,10 +889,10 @@ int uds_search_cached_record_page(struct volume *volume, struct uds_request *req
 	if (record_page_number == NO_CHAPTER_INDEX_ENTRY)
 		return UDS_SUCCESS;
 
-	result = ASSERT(record_page_number < geometry->record_pages_per_chapter,
-			"0 <= %d < %u", record_page_number,
-			geometry->record_pages_per_chapter);
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT(record_page_number < geometry->record_pages_per_chapter,
+			    "0 <= %d < %u", record_page_number,
+			    geometry->record_pages_per_chapter);
+	if (result != VDO_SUCCESS)
 		return result;
 
 	page_number = geometry->index_pages_per_chapter + record_page_number;
@@ -1501,10 +1501,10 @@ static int __must_check initialize_page_cache(struct page_cache *cache,
 	cache->zone_count = zone_count;
 	atomic64_set(&cache->clock, 1);
 
-	result = ASSERT((cache->cache_slots <= VOLUME_CACHE_MAX_ENTRIES),
-			"requested cache size, %u, within limit %u",
-			cache->cache_slots, VOLUME_CACHE_MAX_ENTRIES);
-	if (result != UDS_SUCCESS)
+	result = VDO_ASSERT((cache->cache_slots <= VOLUME_CACHE_MAX_ENTRIES),
+			    "requested cache size, %u, within limit %u",
+			    cache->cache_slots, VOLUME_CACHE_MAX_ENTRIES);
+	if (result != VDO_SUCCESS)
 		return result;
 
 	result = vdo_allocate(VOLUME_CACHE_MAX_QUEUED_READS, struct queued_read,
drivers/md/dm-vdo/permassert.c +1 -1
index 3fa752ba0061..6fe49c4b7e51 100644
@@ -8,7 +8,7 @@
 #include "errors.h"
 #include "logger.h"
 
-int uds_assertion_failed(const char *expression_string, const char *file_name,
+int vdo_assertion_failed(const char *expression_string, const char *file_name,
 			 int line_number, const char *format, ...)
 {
 	va_list args;
drivers/md/dm-vdo/permassert.h +2 -6
index 8774dde7927a..c34f2ba650e1 100644
@@ -33,16 +33,12 @@ static inline int __must_check vdo_must_use(int value)
 /* Log a message if the expression is not true. */
 #define VDO_ASSERT_LOG_ONLY(expr, ...) __VDO_ASSERT(expr, __VA_ARGS__)
 
-/* For use by UDS */
-#define ASSERT(expr, ...) VDO_ASSERT(expr, __VA_ARGS__)
-#define ASSERT_LOG_ONLY(expr, ...) __VDO_ASSERT(expr, __VA_ARGS__)
-
 #define __VDO_ASSERT(expr, ...)				      \
 	(likely(expr) ? VDO_SUCCESS			      \
-		      : uds_assertion_failed(STRINGIFY(expr), __FILE__, __LINE__, __VA_ARGS__))
+		      : vdo_assertion_failed(STRINGIFY(expr), __FILE__, __LINE__, __VA_ARGS__))
 
 /* Log an assertion failure message. */
-int uds_assertion_failed(const char *expression_string, const char *file_name,
+int vdo_assertion_failed(const char *expression_string, const char *file_name,
 			 int line_number, const char *format, ...)
 	__printf(4, 5);
 
Signature · 1 line
2.42.0
author maintainer
#10 lore raw

PATCH 10/10 dm vdo target: eliminate inappropriate uses of UDS_SUCCESS

In reply to Matthew Sakai

From: Mike Snitzer <[email protected]>

Most should be VDO_SUCCESS. But comparing the return from kstrtouint() with UDS_SUCCESS (happens to be 0) makes no sense.

---
 drivers/md/dm-vdo/dm-vdo-target.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/md/dm-vdo/dm-vdo-target.c +7 -7
index e493b2fec90b..5f607dbb16e9 100644
@@ -318,7 +318,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
 	current_substring++;
 	/* substrings[current_substring] is NULL already */
 	*substring_array_ptr = substrings;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /*
@@ -356,7 +356,7 @@ static int join_strings(char **substring_array, size_t array_length, char separa
 		*(current_position - 1) = '\0';
 
 	*string_ptr = output;
-	return UDS_SUCCESS;
+	return VDO_SUCCESS;
 }
 
 /**
@@ -484,7 +484,7 @@ static int parse_one_thread_config_spec(const char *spec,
 	int result;
 
 	result = split_string(spec, '=', &fields);
-	if (result != UDS_SUCCESS)
+	if (result != VDO_SUCCESS)
 		return result;
 
 	if ((fields[0] == NULL) || (fields[1] == NULL) || (fields[2] != NULL)) {
@@ -495,7 +495,7 @@ static int parse_one_thread_config_spec(const char *spec,
 	}
 
 	result = kstrtouint(fields[1], 10, &count);
-	if (result != UDS_SUCCESS) {
+	if (result) {
 		uds_log_error("thread config string error: integer value needed, found \"%s\"",
 			      fields[1]);
 		free_string_array(fields);
@@ -537,7 +537,7 @@ static int parse_thread_config_string(const char *string,
 		unsigned int i;
 
 		result = split_string(string, ',', &specs);
-		if (result != UDS_SUCCESS)
+		if (result != VDO_SUCCESS)
 			return result;
 
 		for (i = 0; specs[i] != NULL; i++) {
@@ -607,7 +607,7 @@ static int parse_one_key_value_pair(const char *key, const char *value,
 
 	/* The remaining arguments must have integral values. */
 	result = kstrtouint(value, 10, &count);
-	if (result != UDS_SUCCESS) {
+	if (result) {
 		uds_log_error("optional config string error: integer value needed, found \"%s\"",
 			      value);
 		return result;
@@ -2913,7 +2913,7 @@ static int __init vdo_init(void)
 
 	/* Add VDO errors to the set of errors registered by the indexer. */
 	result = vdo_register_status_codes();
-	if (result != UDS_SUCCESS) {
+	if (result != VDO_SUCCESS) {
 		uds_log_error("vdo_register_status_codes failed %d", result);
 		vdo_module_destroy();
 		return result;
Signature · 1 line
2.42.0