summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-04-12 07:54:48 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 15:07:40 +0200
commit055ed193b190edac539f37a66699b02eae3a19a9 (patch)
tree4d0aedf9290ac17f041fdbe15e83ec338535d522 /include/linux/kernel.h
parentac2370ac2bc5215daf78546cd8d925510065bb7f (diff)
staging: lustre: convert lov_pool to use rhashtable
The pools hashtable can be implemented using the rhashtable implementation in lib. This has the benefit that lookups are lock-free. We need to use kfree_rcu() to free a pool so that a lookup racing with a deletion will not access freed memory. rhashtable has no combined lookup-and-delete interface, but as the lookup is lockless and the chains are short, this brings little cost. Even if a lookup finds a pool, we must be prepared for the delete to fail to find it, as we might race with another thread doing a delete. We use atomic_inc_not_zero() after finding a pool in the hash table and if that fails, we must have raced with a deletion, so we treat the lookup as a failure. Use hashlen_string() rather than a hand-crafted hash function. Note that the pool_name, and the search key, are guaranteed to be nul terminated. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernel.h')
0 files changed, 0 insertions, 0 deletions