cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH RESEND v5.18-rc1 15/19] fs: dlm: move conversion to compile time
Date: Mon,  4 Apr 2022 16:06:42 -0400	[thread overview]
Message-ID: <20220404200646.3170301-16-aahringo@redhat.com> (raw)
In-Reply-To: <20220404200646.3170301-1-aahringo@redhat.com>

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>
---
 fs/dlm/midcomms.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
index bd4bed09ab2b..649efe120eee 100644
--- a/fs/dlm/midcomms.c
+++ b/fs/dlm/midcomms.c
@@ -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",
-- 
2.31.1


  parent reply	other threads:[~2022-04-04 20:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 20:06 [Cluster-devel] [PATCH RESEND v5.18-rc1 00/19] fs: dlm: resend patches for v5.18-rc1 Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 01/19] fs: dlm: uninitialized variable on error in dlm_listen_for_all() Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 02/19] fs: dlm: fix missing check in validate_lock_args Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 03/19] fs: dlm: fix plock invalid read Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 04/19] fs: dlm: replace sanity checks with WARN_ON Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 05/19] fs: dlm: cleanup plock_op vs plock_xop Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 06/19] fs: dlm: rearrange async condition return Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 07/19] fs: dlm: improve plock logging if interrupted Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 08/19] fs: dlm: remove unnecessary INIT_LIST_HEAD() Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 09/19] fs: dlm: move global to static inits Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 10/19] fs: dlm: add __CHECKER__ for false positives Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 11/19] fs: dlm: use __le types for options header Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 12/19] fs: dlm: use __le types for dlm header Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 13/19] fs: dlm: use __le types for rcom messages Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 14/19] fs: dlm: use __le types for dlm messages Alexander Aring
2022-04-04 20:06 ` Alexander Aring [this message]
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 16/19] fs: dlm: remove __user conversion warnings Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 17/19] fs: dlm: remove found label in dlm_master_lookup Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 18/19] fs: dlm: cleanup lock handling " Alexander Aring
2022-04-04 20:06 ` [Cluster-devel] [PATCH RESEND v5.18-rc1 19/19] fs: dlm: check required context while close Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220404200646.3170301-16-aahringo@redhat.com \
    --to=aahringo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).