mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
Revert "rw_semaphore: remove up/down_read_non_owner"
This reverts commit 11b80f459a
.
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>
This commit is contained in:
parent
a937536b86
commit
84759c6d18
@ -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 */
|
||||
|
@ -126,6 +126,15 @@ void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest)
|
||||
|
||||
EXPORT_SYMBOL(_down_write_nest_lock);
|
||||
|
||||
void down_read_non_owner(struct rw_semaphore *sem)
|
||||
{
|
||||
might_sleep();
|
||||
|
||||
__down_read(sem);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(down_read_non_owner);
|
||||
|
||||
void down_write_nested(struct rw_semaphore *sem, int subclass)
|
||||
{
|
||||
might_sleep();
|
||||
@ -136,6 +145,13 @@ void down_write_nested(struct rw_semaphore *sem, int subclass)
|
||||
|
||||
EXPORT_SYMBOL(down_write_nested);
|
||||
|
||||
void up_read_non_owner(struct rw_semaphore *sem)
|
||||
{
|
||||
__up_read(sem);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(up_read_non_owner);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user