summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_io.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-01-28 08:39:18 +0000
committerphk <phk@FreeBSD.org>2004-01-28 08:39:18 +0000
commitd82e43eede8f1e8b323ead0af1c28f795c657e4d (patch)
tree1421c276703192b70743bca8ffb7c24603bf0f4f /sys/geom/geom_io.c
parent860115ff61133d494820140aaffe13b6bd0d0256 (diff)
downloadFreeBSD-src-d82e43eede8f1e8b323ead0af1c28f795c657e4d.zip
FreeBSD-src-d82e43eede8f1e8b323ead0af1c28f795c657e4d.tar.gz
Bring back the geom_bioqueues, they _are_ a good idea.
ATA will uses these RSN.
Diffstat (limited to 'sys/geom/geom_io.c')
-rw-r--r--sys/geom/geom_io.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 446702a..28c3b32 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
static struct g_bioq g_bio_run_down;
static struct g_bioq g_bio_run_up;
+static struct g_bioq g_bio_run_task;
static u_int pace;
static uma_zone_t biozone;
@@ -151,6 +152,7 @@ g_io_init()
g_bioq_init(&g_bio_run_down);
g_bioq_init(&g_bio_run_up);
+ g_bioq_init(&g_bio_run_task);
biozone = uma_zcreate("g_bio", sizeof (struct bio),
NULL, NULL,
NULL, NULL,
@@ -359,6 +361,23 @@ g_io_schedule_down(struct thread *tp __unused)
}
void
+bio_taskqueue(struct bio *bp, bio_task_t *func, void *arg)
+{
+ bp->bio_task = func;
+ bp->bio_task_arg = arg;
+ /*
+ * The taskqueue is actually just a second queue off the "up"
+ * queue, so we use the same lock.
+ */
+ g_bioq_lock(&g_bio_run_up);
+ TAILQ_INSERT_TAIL(&g_bio_run_task.bio_queue, bp, bio_queue);
+ g_bio_run_task.bio_queue_length++;
+ wakeup(&g_wait_up);
+ g_bioq_unlock(&g_bio_run_up);
+}
+
+
+void
g_io_schedule_up(struct thread *tp __unused)
{
struct bio *bp;
@@ -368,6 +387,14 @@ g_io_schedule_up(struct thread *tp __unused)
mtx_init(&mymutex, "g_xup", NULL, MTX_DEF);
for(;;) {
g_bioq_lock(&g_bio_run_up);
+ bp = g_bioq_first(&g_bio_run_task);
+ if (bp != NULL) {
+ g_bioq_unlock(&g_bio_run_up);
+ mtx_lock(&mymutex);
+ bp->bio_task(bp->bio_task_arg);
+ mtx_unlock(&mymutex);
+ continue;
+ }
bp = g_bioq_first(&g_bio_run_up);
if (bp != NULL) {
g_bioq_unlock(&g_bio_run_up);
OpenPOWER on IntegriCloud