mirror_zfs/module/splat
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
..
Makefile.in Add script for builtin module building. 2012-07-26 15:13:09 -07:00
splat-atomic.c splat atomic:64-bit: Create thread outside spin lock 2012-11-06 14:48:57 -08:00
splat-condvar.c Linux compat 3.7, kernel_thread() 2012-12-03 09:36:21 -08:00
splat-cred.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-ctl.c splat: Fix log buffer locking 2012-11-06 14:48:56 -08:00
splat-generic.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-internal.h splat: Fix log buffer locking 2012-11-06 14:48:56 -08:00
splat-kmem.c splat kmem:slab_overcommit: Disabled 2012-11-06 14:48:57 -08:00
splat-kobj.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-linux.c splat linux:shrinker: Fix fail-safe 2012-12-12 09:04:29 -08:00
splat-list.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-mutex.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-random.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-rwlock.c Linux compat 3.7, kernel_thread() 2012-12-03 09:36:21 -08:00
splat-taskq.c taskq delay/cancel functionality 2012-12-12 09:54:07 -08:00
splat-thread.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-time.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-vnode.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00
splat-zlib.c splat: Cleanup headers 2012-11-06 14:48:56 -08:00