From 01aca8ca222373d71941cd007bdc00260bd3ff5c Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Fri, 21 Jan 2005 18:27:37 +0000 Subject: [PATCH] rx-hash-table-mod-prime-20050121 see https://lists.openafs.org/pipermail/openafs-devel/2004-September/010967.htmland https://lists.openafs.org/pipermail/openafs-devel/2004-September/010968.html --- src/rx/rx_globals.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index b47f4a8a1..48774f00f 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -249,16 +249,15 @@ EXT struct rx_stats rx_stats; EXT struct rx_peer **rx_peerHashTable; EXT struct rx_connection **rx_connHashTable; EXT struct rx_connection *rx_connCleanup_list INIT(0); -EXT afs_uint32 rx_hashTableSize INIT(256); /* Power of 2 */ -EXT afs_uint32 rx_hashTableMask INIT(255); /* One less than rx_hashTableSize */ +EXT afs_uint32 rx_hashTableSize INIT(257); /* Prime number */ #ifdef RX_ENABLE_LOCKS EXT afs_kmutex_t rx_peerHashTable_lock; EXT afs_kmutex_t rx_connHashTable_lock; #endif /* RX_ENABLE_LOCKS */ -#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)&rx_hashTableMask)) +#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)%rx_hashTableSize)) -#define PEER_HASH(host, port) ((host ^ port) & rx_hashTableMask) +#define PEER_HASH(host, port) ((host ^ port) % rx_hashTableSize) /* Forward definitions of internal procedures */ #define rxi_ChallengeOff(conn) rxevent_Cancel((conn)->challengeEvent, (struct rx_call*)0, 0); -- 2.39.5