X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flibcfs_hash.h;fp=libcfs%2Finclude%2Flibcfs%2Flibcfs_hash.h;h=b541fe3c48b17b806fef7de8eb309b5239786d97;hp=bd3d7d0900fc2033f5b31011412b26076e31c3c1;hb=f3cdf905c522837e2cdce779a03b4ecf16313c65;hpb=dbafa9df0f8f72ff8849af9066eac46a2c980e9f diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h index bd3d7d0..b541fe3 100644 --- a/libcfs/include/libcfs/libcfs_hash.h +++ b/libcfs/include/libcfs/libcfs_hash.h @@ -74,6 +74,7 @@ struct cfs_hash_hlist_ops; union cfs_hash_lock { rwlock_t rw; /**< rwlock */ spinlock_t spin; /**< spinlock */ + struct rw_semaphore rw_sem; /**< rwsem */ }; /** @@ -155,6 +156,8 @@ enum cfs_hash_tag { * change on hash table is non-blocking */ CFS_HASH_NBLK_CHANGE = 1 << 13, + /** rw semaphore lock to protect bucket */ + CFS_HASH_RW_SEM_BKTLOCK = 1 << 14, /** NB, we typed hs_flags as __u16, please change it * if you need to extend >=16 flags */ }; @@ -360,6 +363,13 @@ cfs_hash_with_spin_bktlock(struct cfs_hash *hs) } static inline int +cfs_hash_with_rw_sem_bktlock(struct cfs_hash *hs) +{ + /* rw sem lock to protect hash bucket */ + return (hs->hs_flags & CFS_HASH_RW_SEM_BKTLOCK) != 0; +} + +static inline int cfs_hash_with_add_tail(struct cfs_hash *hs) { return (hs->hs_flags & CFS_HASH_ADD_TAIL) != 0;