summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2014-01-16 14:34:53 +0000
committeravg <avg@FreeBSD.org>2014-01-16 14:34:53 +0000
commita4ee4e9fb09b34a005aa5d3419f6f11315b33b22 (patch)
tree2d91d8fef744bd0b49b0838ae98faf63886f692a /sys/cddl/contrib/opensolaris/uts
parent16f4d5cb308e45e3fe74758e164b70dfc0f56d64 (diff)
downloadFreeBSD-src-a4ee4e9fb09b34a005aa5d3419f6f11315b33b22.zip
FreeBSD-src-a4ee4e9fb09b34a005aa5d3419f6f11315b33b22.tar.gz
MFC r258630: 734 taskq_dispatch_prealloc() desired
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h8
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c34
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h8
4 files changed, 33 insertions, 19 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
index 31bc32d..a5c6b16 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -825,7 +825,7 @@ static taskq_t *
spa_taskq_create(spa_t *spa, const char *name, enum zti_modes mode,
uint_t value)
{
- uint_t flags = TASKQ_PREPOPULATE;
+ uint_t flags = 0;
boolean_t batch = B_FALSE;
switch (mode) {
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
index b001e11..70a8a7e 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
@@ -24,6 +24,7 @@
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _ZIO_H
@@ -474,10 +475,9 @@ struct zio {
zio_cksum_report_t *io_cksum_report;
uint64_t io_ena;
-#ifdef _KERNEL
- /* FreeBSD only. */
- struct ostask io_task;
-#endif
+ /* Taskq dispatching state */
+ taskq_ent_t io_tqent;
+
avl_node_t io_trim_node;
list_node_t io_trim_link;
};
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
index 425a8ff..c5bcc8e 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
@@ -1224,7 +1225,7 @@ zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
{
spa_t *spa = zio->io_spa;
zio_type_t t = zio->io_type;
- int flags = TQ_SLEEP | (cutinline ? TQ_FRONT : 0);
+ int flags = (cutinline ? TQ_FRONT : 0);
ASSERT(q == ZIO_TASKQ_ISSUE || q == ZIO_TASKQ_INTERRUPT);
@@ -1250,13 +1251,19 @@ zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
q++;
ASSERT3U(q, <, ZIO_TASKQ_TYPES);
-#ifdef _KERNEL
- (void) taskq_dispatch_safe(spa->spa_zio_taskq[t][q],
- (task_func_t *)zio_execute, zio, flags, &zio->io_task);
+
+ /*
+ * NB: We are assuming that the zio can only be dispatched
+ * to a single taskq at a time. It would be a grievous error
+ * to dispatch the zio to another taskq at the same time.
+ */
+#if defined(illumos) || !defined(_KERNEL)
+ ASSERT(zio->io_tqent.tqent_next == NULL);
#else
- (void) taskq_dispatch(spa->spa_zio_taskq[t][q],
- (task_func_t *)zio_execute, zio, flags);
+ ASSERT(zio->io_tqent.tqent_task.ta_pending == 0);
#endif
+ taskq_dispatch_ent(spa->spa_zio_taskq[t][q],
+ (task_func_t *)zio_execute, zio, flags, &zio->io_tqent);
}
static boolean_t
@@ -3174,16 +3181,15 @@ zio_done(zio_t *zio)
* Reexecution is potentially a huge amount of work.
* Hand it off to the otherwise-unused claim taskq.
*/
-#ifdef _KERNEL
- (void) taskq_dispatch_safe(
- spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
- (task_func_t *)zio_reexecute, zio, TQ_SLEEP,
- &zio->io_task);
+#if defined(illumos) || !defined(_KERNEL)
+ ASSERT(zio->io_tqent.tqent_next == NULL);
#else
- (void) taskq_dispatch(
- spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
- (task_func_t *)zio_reexecute, zio, TQ_SLEEP);
+ ASSERT(zio->io_tqent.tqent_task.ta_pending == 0);
#endif
+ (void) taskq_dispatch_ent(
+ spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
+ (task_func_t *)zio_reexecute, zio, 0,
+ &zio->io_tqent);
}
return (ZIO_PIPELINE_STOP);
}
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h b/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h
index 246e470..1d8bfd6 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h
@@ -45,6 +45,12 @@ typedef struct taskq taskq_t;
typedef uintptr_t taskqid_t;
typedef void (task_func_t)(void *);
+typedef struct taskq_ent {
+ struct task tqent_task;
+ task_func_t *tqent_func;
+ void *tqent_arg;
+} taskq_ent_t;
+
struct proc;
/*
@@ -80,6 +86,8 @@ taskq_t *taskq_create_proc(const char *, int, pri_t, int, int,
taskq_t *taskq_create_sysdc(const char *, int, int, int,
struct proc *, uint_t, uint_t);
taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
+void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
+ taskq_ent_t *);
void nulltask(void *);
void taskq_destroy(taskq_t *);
void taskq_wait(taskq_t *);
OpenPOWER on IntegriCloud