Whamcloud - gitweb
LU-11089 obdclass: use an rwsem instead of lu_key_initing_cnt.
The main use of lu_key_initing_cnt is to wait for it to be zero, so
that lu_context_key_quiesce() can continue. This is a lot
like the behavior of a semaphore.
So use an rwsem instead.
When keys_fill() calls down_read() it will opportunistically spin
while the writer is running. As the writer is very short - just
setting a bit for keys_fill() to see, this is likey to always
be the case.
lu_context_key_quiesce() will now, if necessary, go to sleep until
woken, rather than spin repeatedly calling schedule.
Code is much more readable this way and lu_keys_guard is no longer
involved in this locking.
We can remove the write_lock from lu_context_key_revive() as there is
nothing to protect against. This already mustn't race with
lu_context_key_quiesce(), and if keys_fill() runs concurrently and
doesn't see that LCT_QUIESCENT has been cleared, it hardly matters.
After it is cleared, lu_context_refill() will need to be run anyway.
Change-Id: Id183a9372ca42267cc50f2547823585ff383ea1d
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/32712
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>