Change ldlm_res_hop_hash() to use "bits" instead of "mask" as the
last argument. Otherwise, this is hashing all of the LDLM resources
down to very few buckets (e.g. "hash & 8" or "hash & 11") instead of
the full bit range (e.g. "hash & ((1 << 8) - 1)".
This is causing significant slowdowns for file creation performance,
in particular sanity test_123ac was running 2x slower when creating
a large number of files because of the bad hashing.
Fixes:
ce404bd07c ("LU-17174 misc: fix hash functions")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I823b370bdb7fac4e673d1b479204dd1216931fb6
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54585
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
#undef MAX_STRING_SIZE
static unsigned int ldlm_res_hop_hash(struct cfs_hash *hs,
- const void *key, unsigned int mask)
+ const void *key, const unsigned int bits)
{
const struct ldlm_res_id *id = key;
unsigned int val = 0;
for (i = 0; i < RES_NAME_SIZE; i++)
val += id->name[i];
- return val & mask;
+
+ return val & ((1UL << bits) - 1);
}
static unsigned int ldlm_res_hop_fid_hash(const struct ldlm_res_id *id,
- unsigned int bits)
+ const unsigned int bits)
{
struct lu_fid fid;
__u32 hash;