Whamcloud - gitweb
LU-10467 obdclass: convert waiting in cl_sync_io_wait(). 02/36102/11
authorMr NeilBrown <neilb@suse.com>
Sat, 18 Jan 2020 13:55:58 +0000 (08:55 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Jan 2020 06:03:12 +0000 (06:03 +0000)
commitd6ce546eb7e250237141d3a11380f9d5389c50eb
treec57141b648b21f72dfeeaec8cf29c237b2f99280
parent9c9ea6584cfb314aec693be2b03a0f55f60127a3
LU-10467 obdclass: convert waiting in cl_sync_io_wait().

The l_wait_event() call in cl_sync_io_wait() will wait indefinitely
if timeout is zero, or for a limited time if timeout is positive.
This doesn't have an exact analogue in wait_event* macros, so we
need to revise the code more broadly.

This function will *always* wait until ->csi_sync_nr reaches zero.
The effect of the timeout is:
 1/ to report an error if the count doesn't reach zero in the given
    time
 2/ to return -ETIMEDOUt instead of csi_sync_rc if the timeout was
    exceeded.

So we rearrange the code to make that more obvious.
A small exrta change is that we now call wait_event_idle() again
even if there was a timeout and the first wait succeeded.
This will simply test csi_sync_nr again and not actually wait.
We could protected it with 'rc != 0 || timeout == 0' but there seems
no point.

Signed-off-by: Mr NeilBrown <neilb@suse.com>
Change-Id: I3c507a7fe01bfdf2ed5e9e71ea8215e6cfd0b54e
Reviewed-on: https://review.whamcloud.com/36102
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/cl_io.c