diff options
author | NeilBrown <neilb@suse.com> | 2018-04-12 07:54:48 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-23 15:07:40 +0200 |
commit | 055ed193b190edac539f37a66699b02eae3a19a9 (patch) | |
tree | 4d0aedf9290ac17f041fdbe15e83ec338535d522 /drivers/staging/lustre/lustre/include/obd.h | |
parent | ac2370ac2bc5215daf78546cd8d925510065bb7f (diff) | |
download | op-kernel-dev-055ed193b190edac539f37a66699b02eae3a19a9.zip op-kernel-dev-055ed193b190edac539f37a66699b02eae3a19a9.tar.gz |
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 'drivers/staging/lustre/lustre/include/obd.h')
-rw-r--r-- | drivers/staging/lustre/lustre/include/obd.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 48cf7ab..7e1de03 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -46,6 +46,8 @@ #include <lustre_intent.h> #include <cl_object.h> +#include <linux/rhashtable.h> + #define MAX_OBD_DEVICES 8192 struct osc_async_rc { @@ -383,7 +385,7 @@ struct lov_obd { __u32 lov_tgt_size; /* size of tgts array */ int lov_connects; int lov_pool_count; - struct cfs_hash *lov_pools_hash_body; /* used for key access */ + struct rhashtable lov_pools_hash_body; /* used for key access */ struct list_head lov_pool_list; /* used for sequential access */ struct dentry *lov_pool_debugfs_entry; enum lustre_sec_part lov_sp_me; |