Whamcloud - gitweb
LU-12780 quota: don't use ptlrpc_thread for qmt_reba_thread
Instead of ptlrpc_thread, use native kthread functionality.
- for startup, perform allocations before creating the thread so that
once created it cannot fail.
We still use a completion to ensure the thread function runs before
kthread_stop is called, so that cleanup will happen.
- As lu_env_add() can fail, and needs to know which task owns
the env, we add a new function lu_env_add_task()
- for shutdown, use kthread_stop() and kthread_should_stop()
- to alert thread of a new event, use wake_up_process()
Do this under qmt_reba_lock so the thread cannot disappear while
being woken.
The thread sets TASK_IDLE, then if any tests show there is work
to do it sets TASK_RUNNING, so the following schedule() won't
block and the loop will check again.
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: If3f0444d5aa38ea84990d95f85ad18202f99d5df
Reviewed-on: https://review.whamcloud.com/36556
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>