summaryrefslogtreecommitdiff
path: root/include/linux/percpu-rwsem.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-08-27 17:36:21 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2019-08-27 17:37:03 -0400
commitcc41f52bcc7bcc6ec3a63c10fd2b84bc3e2f6615 (patch)
treebbac64cbd2014ac8ce3ca0ff0bb5e69c51be34db /include/linux/percpu-rwsem.h
parent8b02f791c34eae771442c59a863730c99ac5e1d4 (diff)
Update bcachefs sources to 14f68409be bcachefs: Optimize fiemap
Diffstat (limited to 'include/linux/percpu-rwsem.h')
-rw-r--r--include/linux/percpu-rwsem.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index f286f30..153251c 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -20,6 +20,11 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
pthread_mutex_lock(&sem->lock);
}
+static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
+{
+ return !pthread_mutex_trylock(&sem->lock);
+}
+
static inline void percpu_up_read_preempt_enable(struct percpu_rw_semaphore *sem)
{
pthread_mutex_unlock(&sem->lock);