Whamcloud - gitweb
LU-1346 libcfs: cleanup libcfs atomic primitives
[fs/lustre-release.git] / libcfs / include / libcfs / libcfs_hash.h
index babf3eb..5e7c9de 100644 (file)
@@ -272,12 +272,12 @@ typedef struct cfs_hash {
         /** 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;
@@ -301,12 +301,12 @@ typedef struct cfs_hash {
         __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;
@@ -583,10 +583,10 @@ static inline void cfs_hash_unlock(cfs_hash_t *hs, int excl)
 }
 
 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,
@@ -673,11 +673,10 @@ void cfs_hash_bd_move_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd_old,
                              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,
@@ -831,8 +830,8 @@ static inline int __cfs_hash_theta_frac(int theta)
 
 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)