dlm: move conversion to compile time

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>
This commit is contained in:
Alexander Aring 2022-04-04 16:06:42 -04:00 committed by David Teigland
parent 00e99ccde7
commit 14a92fd703

View 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",