Whamcloud - gitweb
LU-8130 ldlm: separate buckets from ldlm hash table 18/36218/3
authorNeilBrown <neilb@suse.com>
Tue, 17 Sep 2019 19:33:09 +0000 (15:33 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 14 Dec 2019 05:59:20 +0000 (05:59 +0000)
commitd234e2cf5f557eadd4b65758ca76f783fb6ed9a1
treef296c0426e905fad04fbf4429c3cc17fed0f3469
parent514bd936d06141319fb5e8032e4b7fa7bc0d1194
LU-8130 ldlm: separate buckets from ldlm hash table

ldlm maintains a per-namespace hashtable of resources.
With these hash tables it stores per-bucket 'struct adaptive_timeout'
structures.

Presumably having a single struct for the whole table results in too
much contention while having one per resource results in very little
adaption.

A future patch will change ldlm to use rhashtable which does not
support per-bucket data, so we need to manage the data separately.

There is no need for the multiple adaptive_timeout to align with the
hash chains, and trying to do this has resulted in a rather complex
hash function.
The purpose of ldlm_res_hop_fid_hash() appears to be to keep
resources with the same fid in the same hash bucket, so they use
the same adaptive timeout.  However it fails at doing this
because it puts the fid-specific bits in the wrong part of the hash.
If that is not the purpose, then I can see no point to the
complexitiy.

This patch creates a completely separate array of adaptive timeouts
(and other less interesting data) and uses a hash of the fid to index
that, meaning that a simple hash can be used for the hash table.

In the previous code, two namespace uses the same value for
nsd_all_bits and nsd_bkt_bits.  This results in zero bits being
used to choose a bucket - so there is only one bucket.
This looks odd and would confuse hash_32(), so I've adjusted the
numbers so there is always at least 1 bit (2 buckets).

Change-Id: Ifab1b48b35b4a9a56610340556875901ad3804b2
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/36218
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_resource.c