aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev_file.c
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2014-05-13 10:36:35 +0800
committerBrian Behlendorf <[email protected]>2014-05-14 16:20:21 -0700
commitbc25c9325b0e5ced897b9820dad239539d561ec9 (patch)
treedd7a9bf76d0f0aa232ce2eaaa61c083a5238edc9 /module/zfs/vdev_file.c
parent2c33b9127569ad62b4cfe7dd4f651ceeee3d005c (diff)
Use a dedicated taskq for vdev_file
Originally, vdev_file used system_taskq. This would cause a deadlock, especially on system with few CPUs. The reason is that the prefetcher threads, which are on system_taskq, will sometimes be blocked waiting for I/O to finish. If the prefetcher threads consume all the tasks in system_taskq, the I/O cannot be served and thus results in a deadlock. We fix this by creating a dedicated vdev_file_taskq for vdev_file I/O. Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2270
Diffstat (limited to 'module/zfs/vdev_file.c')
-rw-r--r--module/zfs/vdev_file.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c
index 858582aca..330580224 100644
--- a/module/zfs/vdev_file.c
+++ b/module/zfs/vdev_file.c
@@ -36,6 +36,8 @@
* Virtual device vector for files.
*/
+static taskq_t *vdev_file_taskq;
+
static void
vdev_file_hold(vdev_t *vd)
{
@@ -184,7 +186,7 @@ vdev_file_io_start(zio_t *zio)
return (ZIO_PIPELINE_CONTINUE);
}
- VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, zio,
+ VERIFY3U(taskq_dispatch(vdev_file_taskq, vdev_file_io_strategy, zio,
TQ_PUSHPAGE), !=, 0);
return (ZIO_PIPELINE_STOP);
@@ -209,6 +211,21 @@ vdev_ops_t vdev_file_ops = {
B_TRUE /* leaf vdev */
};
+void
+vdev_file_init(void)
+{
+ vdev_file_taskq = taskq_create("vdev_file_taskq", 100, minclsyspri,
+ max_ncpus, INT_MAX, TASKQ_PREPOPULATE | TASKQ_THREADS_CPU_PCT);
+
+ VERIFY(vdev_file_taskq);
+}
+
+void
+vdev_file_fini(void)
+{
+ taskq_destroy(vdev_file_taskq);
+}
+
/*
* From userland we access disks just like files.
*/