Whamcloud - gitweb
LU-9679 osc: convert cl_cache_waiters to a wait_queue. 75/38575/4
authorOleg Drokin <green@whamcloud.com>
Tue, 12 May 2020 00:05:32 +0000 (20:05 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 May 2020 19:56:59 +0000 (19:56 +0000)
commit5b9581087c138305a1d4202d496cfd1494a71f1c
tree87757e6348608c38f075e0e57b90d3a92ddc1774
parent05dc36b07fc1ac40988f7994cd37cd239d9a8986
LU-9679 osc: convert cl_cache_waiters to a wait_queue.

cli->cl_cache_waiters is a list of tasks that need
to be woken when grant-space becomes available.  This
means it is acting much like a wait queue.
So let's change it to really be a wait queue.

The current implementation adds new waiters to the end of the list,
and calls osc_enter_cache_try() on each in order.  We can provide the
same behaviour by using an exclusive wait, and having each waiter wake
the next task when it succeeds.

If a waiter notices that success has become impossible, it wakes all
other waiters.

If a waiter times out, it doesn't wake other - just leaves them to
time out themselves.

Note that the old code handled -EINTR from the wait function.  That is
not a possible return value when wait_event_idle* is used, so that
case is discarded.

As we need wait_event_idle_exclusive_timeout_cmd(), we should fix the
bug in that macro - the "might_sleep()" is wrong, as a spinlock might
be held at that point.

Linux-Commit: 31f45f56ecdf ("lustre: osc_cache: convert
cl_cache_waiters to a wait_queue.")

Lustre-change: https://review.whamcloud.com/37605
Lustre-commit: b2ede01d1ed77ddc512c013220f6ea8b509e9541

Change-Id: Ib7622ea2daea8f6e59bef95d3b6c5a80d209b81e
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/38575
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/linux/linux-wait.h
lustre/include/lustre_osc.h
lustre/include/obd.h
lustre/ldlm/ldlm_lib.c
lustre/osc/osc_cache.c
lustre/osc/osc_internal.h
lustre/osc/osc_page.c