From d8cfdd381be876e2f06c03d0ec64fc06cf8a91f1 Mon Sep 17 00:00:00 2001 From: wangdi Date: Wed, 4 Oct 2006 17:13:46 +0000 Subject: [PATCH] Branch: b_new_cmd update mea hash method to in accordance with ext3 hash method --- lustre/obdclass/mea.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lustre/obdclass/mea.c b/lustre/obdclass/mea.c index a68d82d..d5f5a78 100644 --- a/lustre/obdclass/mea.c +++ b/lustre/obdclass/mea.c @@ -70,6 +70,13 @@ static int mea_hash_segment(int count, char *name, int namelen) __u64 hash; __u32 hash_segment = MAX_HASH_SIZE; + if (namelen == 0) + return 0; + if (strncmp(name, ".", 1) == 0 && namelen == 1) + return 1; + if (strncmp(name, "..", 2) == 0 && namelen == 2) + return 2; + hinfo.hash_version = LDISKFS_DX_HASH_TEA; hinfo.seed = 0; result = ldiskfsfs_dirhash(name, namelen, &hinfo); @@ -78,6 +85,7 @@ static int mea_hash_segment(int count, char *name, int namelen) do_div(hash_segment, count); do_div(hash, hash_segment); LASSERT(hash <= count); + return hash; } #else -- 1.8.3.1