* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
/** hash list operations */
struct cfs_hash_hlist_ops *hs_hops;
/** hash buckets-table */
- cfs_hash_bucket_t **hs_buckets;
- /** total number of items on this hash-table */
- cfs_atomic_t hs_count;
- /** hash flags, see cfs_hash_tag for detail */
- __u16 hs_flags;
- /** # of extra-bytes for bucket, for user saving extended attributes */
+ cfs_hash_bucket_t **hs_buckets;
+ /** total number of items on this hash-table */
+ atomic_t hs_count;
+ /** hash flags, see cfs_hash_tag for detail */
+ __u16 hs_flags;
+ /** # of extra-bytes for bucket, for user saving extended attributes */
__u16 hs_extra_bytes;
/** wants to iterate */
__u8 hs_iterating;
__u32 hs_rehash_count;
/** # of iterators (caller of cfs_hash_for_each_*) */
__u32 hs_iterators;
- /** rehash workitem */
- cfs_workitem_t hs_rehash_wi;
- /** refcount on this hash table */
- cfs_atomic_t hs_refcount;
- /** rehash buckets-table */
- cfs_hash_bucket_t **hs_rehash_buckets;
+ /** rehash workitem */
+ cfs_workitem_t hs_rehash_wi;
+ /** refcount on this hash table */
+ atomic_t hs_refcount;
+ /** rehash buckets-table */
+ cfs_hash_bucket_t **hs_rehash_buckets;
#if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1
/** serialize debug members */
spinlock_t hs_dep_lock;
}
static inline int cfs_hash_dec_and_lock(cfs_hash_t *hs,
- cfs_atomic_t *condition)
+ atomic_t *condition)
{
- LASSERT(cfs_hash_with_no_bktlock(hs));
- return cfs_atomic_dec_and_lock(condition, &hs->hs_lock.spin);
+ LASSERT(cfs_hash_with_no_bktlock(hs));
+ return atomic_dec_and_lock(condition, &hs->hs_lock.spin);
}
static inline void cfs_hash_bd_lock(cfs_hash_t *hs,
cfs_hash_bd_t *bd_new, cfs_hlist_node_t *hnode);
static inline int cfs_hash_bd_dec_and_lock(cfs_hash_t *hs, cfs_hash_bd_t *bd,
- cfs_atomic_t *condition)
+ atomic_t *condition)
{
- LASSERT(cfs_hash_with_spin_bktlock(hs));
- return cfs_atomic_dec_and_lock(condition,
- &bd->bd_bucket->hsb_lock.spin);
+ LASSERT(cfs_hash_with_spin_bktlock(hs));
+ return atomic_dec_and_lock(condition, &bd->bd_bucket->hsb_lock.spin);
}
static inline cfs_hlist_head_t *cfs_hash_bd_hhead(cfs_hash_t *hs,
static inline int __cfs_hash_theta(cfs_hash_t *hs)
{
- return (cfs_atomic_read(&hs->hs_count) <<
- CFS_HASH_THETA_BITS) >> hs->hs_cur_bits;
+ return (atomic_read(&hs->hs_count) <<
+ CFS_HASH_THETA_BITS) >> hs->hs_cur_bits;
}
static inline void __cfs_hash_set_theta(cfs_hash_t *hs, int min, int max)