diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index 8310f73212..33e5cadd03 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -34,8 +34,6 @@ typedef struct SMgrEntry SMgrRelation data; /* Pointer to the SMgrRelationData */ } SMgrEntry; -static inline uint32 relfilenodebackend_hash(RelFileNodeBackend *rnode); - /* * Because simplehash.h does not provide a stable pointer to hash table * entries, we don't make the element type a SMgrRelation directly, instead we @@ -51,7 +49,7 @@ static inline uint32 relfilenodebackend_hash(RelFileNodeBackend *rnode); #define SH_ELEMENT_TYPE SMgrEntry #define SH_KEY_TYPE RelFileNodeBackend #define SH_KEY data->smgr_rnode -#define SH_HASH_KEY(tb, key) relfilenodebackend_hash(&key) +#define SH_HASH_KEY(tb, key) hash_bytes((const unsigned char *) &key, sizeof(RelFileNodeBackend)) #define SH_EQUAL(tb, a, b) (memcmp(&a, &b, sizeof(RelFileNodeBackend)) == 0) #define SH_SCOPE static inline #define SH_STORE_HASH @@ -133,37 +131,6 @@ static dlist_head unowned_relns; /* local function prototypes */ static void smgrshutdown(int code, Datum arg); -/* - * relfilenodebackend_hash - * Custom rolled hash function for simplehash table. - * - * smgropen() is often a bottleneck in CPU bound workloads during crash - * recovery. We make use of this custom hash function rather than using - * hash_bytes as it gives us a little bit more performance. - * - * XXX What if sizeof(Oid) is not 4? - */ -static inline uint32 -relfilenodebackend_hash(RelFileNodeBackend *rnode) -{ - uint32 hashkey; - - hashkey = murmurhash32((uint32) rnode->node.spcNode); - - /* rotate hashkey left 1 bit at each step */ - hashkey = pg_rotate_left32(hashkey, 1); - hashkey ^= murmurhash32((uint32) rnode->node.dbNode); - - hashkey = pg_rotate_left32(hashkey, 1); - hashkey ^= murmurhash32((uint32) rnode->node.relNode); - - hashkey = pg_rotate_left32(hashkey, 1); - hashkey ^= murmurhash32((uint32) rnode->backend); - - return hashkey; -} - - /* * smgrinit(), smgrshutdown() -- Initialize or shut down storage * managers.