Whamcloud - gitweb
LU-12780 target: don't use ptlrpc_thread for txn_commit_thread
rather than ptlrpc_thread, use native kthreads functionality.
- there is no need to synchronize on startup, the initialization
can be done before the thread is started. This requires adding
an lu_env to struct target_distribute_txn_data so
distribute_txn_init() can set it up before starting the thread.
- correspondingly, the cleanup is best done outside of the thread too,
as it is possible for kthread_stop() to stop a thread before
the function is called even once. So the lu_env_fini is moved to
distrbute_txn_fini(). and ->tdtd_list is cleaned up there too
just incase the thread didn't have a chance to run.
- kthread_stop/kthread_should_stop is used to synchornize
shutdown
- signaling the thread is done with wake_up_process().
The thread sets TASK_IDLE at the top of the loop, then
sets TASK_RUNNING if it finds anything to do, and finally
calls schedule() at the end. This makes
tdtd_ready_for_cancel_log() unnecesary as it just duplicates
checks that are already present in distribute_txn_commit_thread().
Change-Id: I06c3686b90faa6c6b638b8d6c69cd4e05c2783f4
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/36260
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>