summaryrefslogtreecommitdiffstats
path: root/include/linux/rwsem.h
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2011-09-21 21:43:05 -0700
committerKent Overstreet <koverstreet@google.com>2013-03-23 15:53:52 -0700
commit84759c6d18c5144432781ddca037d929ee9db8a5 (patch)
treea2f7507dbd760ad87d607c9e80a4c79d96222502 /include/linux/rwsem.h
parenta937536b868b8369b98967929045f1df54234323 (diff)
downloadblackbird-op-linux-84759c6d18c5144432781ddca037d929ee9db8a5.tar.gz
blackbird-op-linux-84759c6d18c5144432781ddca037d929ee9db8a5.zip
Revert "rw_semaphore: remove up/down_read_non_owner"
This reverts commit 11b80f459adaf91a712f95e7734a17655a36bf30. Bcache needs rw semaphores for cache coherency in writeback mode - writes have to take a read lock on a per cache device rw sem, and release it when the bio completes. But since this is for bios it's naturally not in the context of the process that originally took the lock. Signed-off-by: Kent Overstreet <koverstreet@google.com> CC: Christoph Hellwig <hch@infradead.org> CC: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/rwsem.h')
-rw-r--r--include/linux/rwsem.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 8da67d625e13..0616ffe45702 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -133,10 +133,20 @@ do { \
_down_write_nest_lock(sem, &(nest_lock)->dep_map); \
} while (0);
+/*
+ * Take/release a lock when not the owner will release it.
+ *
+ * [ This API should be avoided as much as possible - the
+ * proper abstraction for this case is completions. ]
+ */
+extern void down_read_non_owner(struct rw_semaphore *sem);
+extern void up_read_non_owner(struct rw_semaphore *sem);
#else
# define down_read_nested(sem, subclass) down_read(sem)
# define down_write_nest_lock(sem, nest_lock) down_write(sem)
# define down_write_nested(sem, subclass) down_write(sem)
+# define down_read_non_owner(sem) down_read(sem)
+# define up_read_non_owner(sem) up_read(sem)
#endif
#endif /* _LINUX_RWSEM_H */
OpenPOWER on IntegriCloud