diff mbox series

[1/3] dm vdo: slight cleanup of UDS error codes

Message ID ef09aa6e52a1b1db5eb78f1a78ce389cbeb6b5b0.1706323002.git.msakai@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm vdo: various error code improvements | expand

Commit Message

Matthew Sakai Jan. 27, 2024, 2:42 a.m. UTC
From: Mike Snitzer <snitzer@kernel.org>

No need to increment each UDS_ error code manually (relative to
UDS_ERROR_CODE_BASE).

Also, remove unused PRP_BLOCK_START and PRP_BLOCK_END.

Lastly, UDS_SUCCESS and VDO_SUCCESS are used interchangeably; so best
to explicitly set VDO_SUCCESS equal to UDS_SUCCESS.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/errors.h       | 35 ++++++++++++++++----------------
 drivers/md/dm-vdo/status-codes.h |  4 +---
 2 files changed, 18 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-vdo/errors.h b/drivers/md/dm-vdo/errors.h
index 0129fa37d8d8..c37f198a159c 100644
--- a/drivers/md/dm-vdo/errors.h
+++ b/drivers/md/dm-vdo/errors.h
@@ -15,43 +15,42 @@ 
 enum uds_status_codes {
 	/* Successful return */
 	UDS_SUCCESS = 0,
-
 	/* Used as a base value for reporting internal errors */
 	UDS_ERROR_CODE_BASE = 1024,
 	/* Index overflow */
-	UDS_OVERFLOW = UDS_ERROR_CODE_BASE + 0,
+	UDS_OVERFLOW = UDS_ERROR_CODE_BASE,
 	/* Invalid argument passed to internal routine */
-	UDS_INVALID_ARGUMENT = UDS_ERROR_CODE_BASE + 1,
+	UDS_INVALID_ARGUMENT,
 	/* UDS data structures are in an invalid state */
-	UDS_BAD_STATE = UDS_ERROR_CODE_BASE + 2,
+	UDS_BAD_STATE,
 	/* Attempt to enter the same name into an internal structure twice */
-	UDS_DUPLICATE_NAME = UDS_ERROR_CODE_BASE + 3,
+	UDS_DUPLICATE_NAME,
 	/* An assertion failed */
-	UDS_ASSERTION_FAILED = UDS_ERROR_CODE_BASE + 4,
+	UDS_ASSERTION_FAILED,
 	/* A request has been queued for later processing (not an error) */
-	UDS_QUEUED = UDS_ERROR_CODE_BASE + 5,
+	UDS_QUEUED,
 	/* A problem has occurred with a buffer */
-	UDS_BUFFER_ERROR = UDS_ERROR_CODE_BASE + 6,
+	UDS_BUFFER_ERROR,
 	/* No directory was found where one was expected */
-	UDS_NO_DIRECTORY = UDS_ERROR_CODE_BASE + 7,
+	UDS_NO_DIRECTORY,
 	/* This error range has already been registered */
-	UDS_ALREADY_REGISTERED = UDS_ERROR_CODE_BASE + 8,
+	UDS_ALREADY_REGISTERED,
 	/* Attempt to read or write data outside the valid range */
-	UDS_OUT_OF_RANGE = UDS_ERROR_CODE_BASE + 9,
+	UDS_OUT_OF_RANGE,
 	/* Could not load modules */
-	UDS_EMODULE_LOAD = UDS_ERROR_CODE_BASE + 10,
+	UDS_EMODULE_LOAD,
 	/* The index session is disabled */
-	UDS_DISABLED = UDS_ERROR_CODE_BASE + 11,
+	UDS_DISABLED,
 	/* Unknown error */
-	UDS_UNKNOWN_ERROR = UDS_ERROR_CODE_BASE + 12,
+	UDS_UNKNOWN_ERROR,
 	/* The index configuration or volume format is no longer supported */
-	UDS_UNSUPPORTED_VERSION = UDS_ERROR_CODE_BASE + 13,
+	UDS_UNSUPPORTED_VERSION,
 	/* Some index structure is corrupt */
-	UDS_CORRUPT_DATA = UDS_ERROR_CODE_BASE + 14,
+	UDS_CORRUPT_DATA,
 	/* No index state found */
-	UDS_NO_INDEX = UDS_ERROR_CODE_BASE + 15,
+	UDS_NO_INDEX,
 	/* Attempt to access incomplete index save data */
-	UDS_INDEX_NOT_SAVED_CLEANLY = UDS_ERROR_CODE_BASE + 16,
+	UDS_INDEX_NOT_SAVED_CLEANLY,
 	/* One more than the last UDS_INTERNAL error code */
 	UDS_ERROR_CODE_LAST,
 	/* One more than the last error this block will ever use */
diff --git a/drivers/md/dm-vdo/status-codes.h b/drivers/md/dm-vdo/status-codes.h
index c5da37ec8b55..9e0126a83c6b 100644
--- a/drivers/md/dm-vdo/status-codes.h
+++ b/drivers/md/dm-vdo/status-codes.h
@@ -12,14 +12,12 @@  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,
-	PRP_BLOCK_START = VDO_BLOCK_END,
-	PRP_BLOCK_END = PRP_BLOCK_START + UDS_BLOCK_SIZE,
 };
 
 /* VDO-specific status codes. */
 enum vdo_status_codes {
 	/* successful result */
-	VDO_SUCCESS,
+	VDO_SUCCESS = UDS_SUCCESS,
 	/* base of all VDO errors */
 	VDO_STATUS_CODE_BASE = VDO_BLOCK_START,
 	/* we haven't written this yet */