Convert the ZFS SPA async event mechanism into a dispatch on demand model.

Instead of creating a thread every time we need to handle an async event,
just have one thread per pool hanging around, and have it handle events as
needed.  This means events can be handled independent of whether the syncing
context is hung.  We believe (but have not tested) that this will also fix a
hang in the path from zfs_ioc_clear() when a rollback is necessary.

uts/common/fs/zfs/spa.c:
* Refactor the spa_async_thread() so that it is designed to stay around,
  instead of going away after its tasks are done.
* Move async processing to a new subfunction, spa_async_dispatch().  The old
  spa_async_dispatch() (which used to create the thread) has been retired.
* Add two new routines, spa_async_create() and spa_async_shutdown(), that
  create and destroy the async event thread.
* spa_async_request() now wakes up the async thread in addition to recording
  the requested async task.
* Modify spa_async_tasks_pending() to also return a suggested wait time, so
  that we know how long to wait in case the configuration async tasks need
  to be rate limited.
* Save the suspend count in spa_load_retry(), and restore it after we have
  activated the SPA and created the async thread.

uts/common/fs/zfs/sys/spa_impl.h:
* Use two condition variables for the async thread instead of one.
  * spa_async_sd_cv allows the async thread to tell other contexts when it
    has succesfully shut down or suspended.
  * spa_async_wu_cv allows other threads to wake up the async thread when
    they need an event to be processed, or they want to request a shutdown.
* Add two new SPA flags, spa_async_suspend_done, and spa_async_shutdown, to
  signal when the thread has been suspended successfully, and when a
  shutdown has been requested.

uts/common/fs/zfs/sys/spa.h:
* Add prototypes for spa_async_{create,shutdown}().

uts/common/fs/zfs/spa_misc.c:
* Initialize and destroy the new condition variables and flags.
* Modify spa_shutting_down() so that it detects when either a suspend or
  shutdown has been requested.

cmd/ztest/ztest.c:
* Change the ztest LUN growth test to use the spa_async_{suspend,resume}()
  APIs instead of waiting for the async thread to exit.

Submitted by:	Ken Merry <kenm@spectralogic.com>