Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-12193 quota: use rw_sem to protect lqs_hash
[fs/lustre-release.git]
/
libcfs
/
include
/
libcfs
/
libcfs_hash.h
diff --git
a/libcfs/include/libcfs/libcfs_hash.h
b/libcfs/include/libcfs/libcfs_hash.h
index
bd3d7d0
..
b541fe3
100644
(file)
--- 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 */
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,
* 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 */
};
/** 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
}
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;
cfs_hash_with_add_tail(struct cfs_hash *hs)
{
return (hs->hs_flags & CFS_HASH_ADD_TAIL) != 0;