mirror_zfs/cmd
Brian Behlendorf c25b8f99f8 Simplify threads, mutexs, cvs and rwlocks
* Simplify threads, mutexs, cvs and rwlocks

* Update the zk_thread_create() function to use the same trick
  as Illumos.  Specifically, cast the new pthread_t to a void
  pointer and return that as the kthread_t *.  This avoids the
  issues associated with managing a wrapper structure and is
  safe as long as the callers never attempt to dereference it.

* Update all function prototypes passed to pthread_create() to
  match the expected prototype.  We were getting away this with
  before since the function were explicitly cast.

* Replaced direct zk_thread_create() calls with thread_create()
  for code consistency.  All consumers of libzpool now use the
  proper wrappers.

* The mutex_held() calls were converted to MUTEX_HELD().

* Removed all mutex_owner() calls and retired the interface.
  Instead use MUTEX_HELD() which provides the same information
  and allows the implementation details to be hidden.  In this
  case the use of the pthread_equals() function.

* The kthread_t, kmutex_t, krwlock_t, and krwlock_t types had
  any non essential fields removed.  In the case of kthread_t
  and kcondvar_t they could be directly typedef'd to pthread_t
  and pthread_cond_t respectively.

* Removed all extra ASSERTS from the thread, mutex, rwlock, and
  cv wrapper functions.  In practice, pthreads already provides
  the vast majority of checks as long as we check the return
  code.  Removing this code from our wrappers help readability.

* Added TS_JOINABLE state flag to pass to request a joinable rather
  than detached thread.  This isn't a standard thread_create() state
  but it's the least invasive way to pass this information and is
  only used by ztest.

TEST_ZTEST_TIMEOUT=3600

Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4547 
Closes #5503 
Closes #5523 
Closes #6377 
Closes #6495
2017-08-11 08:51:44 -07:00
..
arc_summary Correct arc_summary and dbufstat python style 2017-03-09 10:21:59 -08:00
arcstat Correct exit code for dbufstat -v and arcstat -v 2016-10-06 10:52:21 -07:00
dbufstat Correct arc_summary and dbufstat python style 2017-03-09 10:21:59 -08:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
raidz_test Simplify threads, mutexs, cvs and rwlocks 2017-08-11 08:51:44 -07:00
vdev_id vdev_id: fix failure due to multipath -l bug 2017-04-20 12:10:55 -07:00
zdb Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zed Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zfs Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zgenhostid Add zgenhostid utility script 2017-07-25 13:22:03 -04:00
zhack Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zinject Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zpios Fix spelling 2017-01-03 11:31:18 -06:00
zpool Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zstreamdump Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
ztest Simplify threads, mutexs, cvs and rwlocks 2017-08-11 08:51:44 -07:00
zvol_id OpenZFS 6314 - buffer overflow in dsl_dataset_name 2016-06-28 13:47:03 -07:00
Makefile.am Add zgenhostid utility script 2017-07-25 13:22:03 -04:00