dlm: move conversion to compile time
authorAlexander Aring <aahringo@redhat.com>
Mon, 4 Apr 2022 20:06:42 +0000 (16:06 -0400)
committerDavid Teigland <teigland@redhat.com>
Wed, 6 Apr 2022 19:02:40 +0000 (14:02 -0500)
This patch is a cleanup to move the byte order conversion to compile
time. In a simple comparison like this it's possible to move it to
static values so the compiler will always convert those values at
compile time.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/midcomms.c

index bd4bed09ab2b3fcf8aecb59f1bb2cd55f62f3ac3..649efe120eee1d7c2d54090e80f2ad3028ca82ff 100644 (file)
@@ -571,14 +571,14 @@ dlm_midcomms_recv_node_lookup(int nodeid, const union dlm_packet *p,
                        return NULL;
                }
 
-               switch (le32_to_cpu(p->rcom.rc_type)) {
-               case DLM_RCOM_NAMES:
+               switch (p->rcom.rc_type) {
+               case cpu_to_le32(DLM_RCOM_NAMES):
                        fallthrough;
-               case DLM_RCOM_NAMES_REPLY:
+               case cpu_to_le32(DLM_RCOM_NAMES_REPLY):
                        fallthrough;
-               case DLM_RCOM_STATUS:
+               case cpu_to_le32(DLM_RCOM_STATUS):
                        fallthrough;
-               case DLM_RCOM_STATUS_REPLY:
+               case cpu_to_le32(DLM_RCOM_STATUS_REPLY):
                        node = nodeid2node(nodeid, 0);
                        if (node) {
                                spin_lock(&node->state_lock);
@@ -738,14 +738,14 @@ static void dlm_midcomms_receive_buffer_3_2(union dlm_packet *p, int nodeid)
                 *
                 * length already checked.
                 */
-               switch (le32_to_cpu(p->rcom.rc_type)) {
-               case DLM_RCOM_NAMES:
+               switch (p->rcom.rc_type) {
+               case cpu_to_le32(DLM_RCOM_NAMES):
                        fallthrough;
-               case DLM_RCOM_NAMES_REPLY:
+               case cpu_to_le32(DLM_RCOM_NAMES_REPLY):
                        fallthrough;
-               case DLM_RCOM_STATUS:
+               case cpu_to_le32(DLM_RCOM_STATUS):
                        fallthrough;
-               case DLM_RCOM_STATUS_REPLY:
+               case cpu_to_le32(DLM_RCOM_STATUS_REPLY):
                        break;
                default:
                        log_print("unsupported rcom type received: %u, will skip this message from node %d",