dlm: use jhash
PATCH 3/3 dlm: use jhash
Use linux/jhash.h instead of our own hash function.
Signed-off-by David Teigland <[email protected]>
---
dir.c | 2 +- dlm_internal.h | 1 + lock.c | 2 +- util.c | 34 ---------------------------------- util.h | 2 -- 5 files changed, 3 insertions(+), 38 deletions(-)
drivers/dlm/dir.c +1 -1
@@ -120,7 +120,7 @@ static inline uint32_t dir_hash(struct d {uint32_t val; - val =dlm_hash (name, len); + val =jhash (name, len,0 ); val &= (ls->ls_dirtbl_size -1 );return val;
drivers/dlm/dlm_internal.h +1 -0
@@ -34,6 +34,7 @@#include <linux/kobject.h> #include <linux/kref.h> #include <linux/kernel.h> +#include <linux/jhash.h> #include <asm/semaphore.h> #include <asm/uaccess.h>
drivers/dlm/lock.c +1 -1
@@ -369,7 +369,7 @@ static int find_rsb(struct dlm_ls *ls, cif (dlm_no_directory (ls)) flags |=R_CREATE ; - hash =dlm_hash (name, namelen); + hash =jhash (name, namelen,0 ); bucket = hash & (ls->ls_rsbtbl_size -1 ); error =search_rsb (ls, name, namelen, bucket, flags, &r);
drivers/dlm/util.c +0 -34
@@ -13,40 +13,6 @@#include "dlm_internal.h" #include "rcom.h" -/** -* dlm_hash - hash an array of data -* @data: the data to be hashed -* @len: the length of data to be hashed -* -* Copied from GFS which copied from... -* -* Take some data and convert it to a 32-bit hash. -* This is the 32-bit FNV-1a hash from: -* http://www.isthe.com/chongo/tech/comp/fnv/ -*/ - -static inline uint32_t hash_more_internal (const void *data,unsigned int len, -uint32_t hash) -{ -unsigned char *p = (unsigned char *)data; -unsigned char *e = p + len; -uint32_t h = hash; - -while (p < e) { - h ^= (uint32_t )(*p++); - h *=0x01000193 ; - } - -return h; -} - -uint32_t dlm_hash (const void *data,int len) -{ -uint32_t h =0x811C9DC5 ; - h =hash_more_internal (data, len, h); -return h; -} -static void header_out (struct dlm_header *hd) { hd->h_version =cpu_to_le32 (hd->h_version);
drivers/dlm/util.h +0 -2
@@ -13,8 +13,6 @@#ifndef __UTIL_DOT_H__#define __UTIL_DOT_H__ -uint32_t dlm_hash (const char *data,int len); -void dlm_message_out (struct dlm_message *ms);void dlm_message_in (struct dlm_message *ms);void dlm_rcom_out (struct dlm_rcom *rc);