From: nikita Date: Thu, 30 Nov 2006 10:27:46 +0000 (+0000) Subject: sabdwich hash. X-Git-Tag: v1_8_0_110~486^2~53 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=70a312d177376ffea3df2d2d0e3eb5196726c64e;p=fs%2Flustre-release.git sabdwich hash. --- diff --git a/lustre/kernel_patches/patches/ext3-iam-separate.patch b/lustre/kernel_patches/patches/ext3-iam-separate.patch index 1772c5a..f25dcfb 100644 --- a/lustre/kernel_patches/patches/ext3-iam-separate.patch +++ b/lustre/kernel_patches/patches/ext3-iam-separate.patch @@ -2887,7 +2887,7 @@ Index: iam/fs/ext3/iam_lvar.c =================================================================== --- iam.orig/fs/ext3/iam_lvar.c +++ iam/fs/ext3/iam_lvar.c -@@ -0,0 +1,1061 @@ +@@ -0,0 +1,1071 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * @@ -3059,9 +3059,10 @@ Index: iam/fs/ext3/iam_lvar.c + return ((void *)ent) + e_size(leaf, ent); +} + -+#define LVAR_HASH_TEA (1) -+#define LVAR_HASH_R5 (0) -+#define LVAR_HASH_PREFIX (0) ++#define LVAR_HASH_SANDWICH (1) ++#define LVAR_HASH_TEA (0) ++#define LVAR_HASH_R5 (0) ++#define LVAR_HASH_PREFIX (0) + +static __u32 hash_build0(const char *name, int namelen) +{ @@ -3088,6 +3089,15 @@ Index: iam/fs/ext3/iam_lvar.c + hinfo.seed = 0; + ext3fs_dirhash(name, namelen, &hinfo); + result = hinfo.hash; ++ if (LVAR_HASH_SANDWICH) { ++ __u32 result2; ++ ++ hinfo.hash_version = DX_HASH_TEA; ++ hinfo.seed = 0; ++ ext3fs_dirhash(name, namelen, &hinfo); ++ result2 = hinfo.hash; ++ result = (0xff000000 & result2) | (0x00ffffff & result); ++ } + } + return result; +} diff --git a/lustre/obdclass/mea.c b/lustre/obdclass/mea.c index 59eea65..051fe79 100644 --- a/lustre/obdclass/mea.c +++ b/lustre/obdclass/mea.c @@ -64,9 +64,10 @@ static int mea_all_chars_hash(int count, char *name, int namelen) #ifdef __KERNEL__ /* This hash calculate method must be same as the lvar hash method */ -#define LVAR_HASH_TEA (1) -#define LVAR_HASH_R5 (0) -#define LVAR_HASH_PREFIX (0) +#define LVAR_HASH_SANDWICH (1) +#define LVAR_HASH_TEA (0) +#define LVAR_HASH_R5 (0) +#define LVAR_HASH_PREFIX (0) static __u32 hash_build0(const char *name, int namelen) { @@ -93,6 +94,15 @@ static __u32 hash_build0(const char *name, int namelen) hinfo.seed = 0; ldiskfsfs_dirhash(name, namelen, &hinfo); result = hinfo.hash; + if (LVAR_HASH_SANDWICH) { + __u32 result2; + + hinfo.hash_version = LDISKFS_DX_HASH_TEA; + hinfo.seed = 0; + ldiskfsfs_dirhash(name, namelen, &hinfo); + result2 = hinfo.hash; + result = (0xff000000 & result2) | (0x00ffffff & result); + } } return result;