mirror_zfs/include
Brian Behlendorf d9acd930b5 taskq delay/cancel functionality
Add the ability to dispatch a delayed task to a taskq.  The desired
behavior is for the task to be queued but not executed by a worker
thread until the expiration time is reached.  To achieve this two
new functions were added.

* taskq_dispatch_delay() -

  This function behaves exactly like taskq_dispatch() however it
takes a third 'expire_time' argument.  The caller should pass the
desired time the task should be executed as an absolute value in
jiffies.  The task is guarenteed not to run before this time, it
may run slightly latter if all the worker threads are busy.

* taskq_cancel_id() -

  Given a task id attempt to cancel the task before it gets executed.
This is primarily useful for canceling delay tasks but can be used for
canceling any previously dispatched task.  There are three possible
return values.

  0      - The task was found and canceled before it was executed.
  ENOENT - The task was not found, either it was already run or an
           invalid task id was supplied by the caller.
  EBUSY  - The task is currently executing any may not be canceled.
           This function will block until the task has been completed.

* taskq_wait_all() -

  The taskq_wait_id() function was renamed taskq_wait_all() to more
clearly reflect its actual behavior.  It is only curreny used by
the splat taskq regression tests.

* taskq_wait_id() -

  Historically, the only difference between this function and
taskq_wait() was that you passed the task id.  In both functions you
would block until ALL lower task ids which executed.  This was
semantically correct but could be very slow particularly if there
were delay tasks submitted.

  To better accomidate the delay tasks this function was reimplemnted.
It will now only block until the passed task id has been completed.

This is actually a fairly low risk change for a few reasons.

* Only new ZFS callers will make use of the new interfaces and
  very little common code was changed to support the new functions.

* The existing taskq_wait() implementation was not changed just
  slightly refactored.

* The newly optimized taskq_wait_id() implementation was never
  used by ZFS we can't accidentally introduce a new bug there.

NOTE: This functionality does not exist in the Illumos taskqs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2012-12-12 09:54:07 -08:00
..
fs Remove autotools products 2012-08-27 11:46:23 -07:00
linux Linux 3.7 compat, __clear_close_on_exec() removed 2012-10-18 13:36:44 -07:00
rpc Remove autotools products 2012-08-27 11:46:23 -07:00
sharefs Remove autotools products 2012-08-27 11:46:23 -07:00
sys taskq delay/cancel functionality 2012-12-12 09:54:07 -08:00
util Remove autotools products 2012-08-27 11:46:23 -07:00
vm Remove autotools products 2012-08-27 11:46:23 -07:00
Makefile.am Add the release component to headers 2012-01-18 11:06:26 -08:00
spl-ctl.h Public Release Prep 2010-05-17 15:18:00 -07:00
spl-debug.h Add missing spl_debug_* helpers 2012-02-09 16:41:46 -08:00
spl-device.h Public Release Prep 2010-05-17 15:18:00 -07:00
spl-trace.h Split <sys/debug.h> header 2010-07-20 13:29:35 -07:00
splat-ctl.h Add linux compatibility tests 2011-06-21 14:02:46 -07:00
strings.h Public Release Prep 2010-05-17 15:18:00 -07:00
unistd.h Public Release Prep 2010-05-17 15:18:00 -07:00