diff mbox series

[01/10] dm vdo errors: remove unused error codes

Message ID 71e1a606ed732a0ee77aecd3d73e75f63903cc7e.1709267597.git.msakai@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm vdo: standardize on VDO_SUCCESS | expand

Commit Message

Matthew Sakai March 1, 2024, 4:38 a.m. UTC
Also define VDO_SUCCESS in a more central location, and
rename error block constants for clarity.

Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 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(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-vdo/errors.c b/drivers/md/dm-vdo/errors.c
index dc1f0533bd7a..df2498553312 100644
--- a/drivers/md/dm-vdo/errors.c
+++ b/drivers/md/dm-vdo/errors.c
@@ -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" },
diff --git a/drivers/md/dm-vdo/errors.h b/drivers/md/dm-vdo/errors.h
index cf15d7243204..c6c085b26a0e 100644
--- a/drivers/md/dm-vdo/errors.h
+++ b/drivers/md/dm-vdo/errors.h
@@ -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 */
diff --git a/drivers/md/dm-vdo/status-codes.c b/drivers/md/dm-vdo/status-codes.c
index efba1ead0aca..92c42b8bbb8b 100644
--- a/drivers/md/dm-vdo/status-codes.c
+++ b/drivers/md/dm-vdo/status-codes.c
@@ -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" },
diff --git a/drivers/md/dm-vdo/status-codes.h b/drivers/md/dm-vdo/status-codes.h
index 5d1e8bbe54b4..eb847def8eb4 100644
--- a/drivers/md/dm-vdo/status-codes.h
+++ b/drivers/md/dm-vdo/status-codes.h
@@ -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[];