From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Fri, 26 Mar 2021 13:33:34 -0400 Subject: [Cluster-devel] [PATCHv3 dlm/next 5/8] fs: dlm: move out some hash functionality In-Reply-To: <20210326173337.44231-1-aahringo@redhat.com> References: <20210326173337.44231-1-aahringo@redhat.com> Message-ID: <20210326173337.44231-6-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch moves out some lowcomms hash functionality into lowcomms header to provide them to other layers like midcomms as well. Signed-off-by: Alexander Aring --- fs/dlm/lowcomms.c | 9 --------- fs/dlm/lowcomms.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index d2be58496fd0..5cb6d7c9ddc1 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -59,7 +59,6 @@ #include "config.h" #define NEEDED_RMEM (4*1024*1024) -#define CONN_HASH_SIZE 32 /* Number of messages to send before rescheduling */ #define MAX_SEND_MSG_COUNT 25 @@ -166,14 +165,6 @@ static void sctp_connect_to_sock(struct connection *con); static void tcp_connect_to_sock(struct connection *con); static void dlm_tcp_shutdown(struct connection *con); -/* This is deliberately very simple because most clusters have simple - sequential nodeids, so we should be able to go straight to a connection - struct in the array */ -static inline int nodeid_hash(int nodeid) -{ - return nodeid & (CONN_HASH_SIZE-1); -} - static struct connection *__find_con(int nodeid) { int r, idx; diff --git a/fs/dlm/lowcomms.h b/fs/dlm/lowcomms.h index 345aed7e00cc..cacfc5620f54 100644 --- a/fs/dlm/lowcomms.h +++ b/fs/dlm/lowcomms.h @@ -13,6 +13,16 @@ #define __LOWCOMMS_DOT_H__ #define LOWCOMMS_MAX_TX_BUFFER_LEN 4096 +#define CONN_HASH_SIZE 32 + +/* This is deliberately very simple because most clusters have simple + * sequential nodeids, so we should be able to go straight to a connection + * struct in the array + */ +static inline int nodeid_hash(int nodeid) +{ + return nodeid & (CONN_HASH_SIZE-1); +} /* switch to check if dlm is running */ extern int dlm_allow_conn; -- 2.26.3