summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-12-09 11:44:52 +0000
committerdlg <dlg@openbsd.org>2013-12-09 11:44:52 +0000
commitd3bae0739c88b828ccc72b57406a053325e0368b (patch)
tree7c2b658162dc2fcf71d4604839a7030a9de6764c /sys
parentremove unused defines (diff)
downloadwireguard-openbsd-d3bae0739c88b828ccc72b57406a053325e0368b.tar.xz
wireguard-openbsd-d3bae0739c88b828ccc72b57406a053325e0368b.zip
replace workq_task_add with a task. stash teh struct in the ata xfer thing
so its now reliable.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/atascsi.c13
-rw-r--r--sys/dev/ata/atascsi.h5
2 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c
index 82a60775e34..6c6ba32bdd5 100644
--- a/sys/dev/ata/atascsi.c
+++ b/sys/dev/ata/atascsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.c,v 1.117 2013/09/18 01:06:26 dlg Exp $ */
+/* $OpenBSD: atascsi.c,v 1.118 2013/12/09 11:44:52 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -1051,6 +1051,7 @@ atascsi_disk_write_same_16_done(struct ata_xfer *xa)
void
atascsi_disk_unmap(struct scsi_xfer *xs)
{
+ struct ata_xfer *xa = xs->io;
struct scsi_unmap *cdb;
struct scsi_unmap_data *unmap;
u_int len;
@@ -1089,12 +1090,12 @@ atascsi_disk_unmap(struct scsi_xfer *xs)
}
/* let's go */
- if (!ISSET(xs->flags, SCSI_NOSLEEP))
+ if (ISSET(xs->flags, SCSI_NOSLEEP)) {
+ task_set(&xa->task, atascsi_disk_unmap_task, xs, NULL);
+ task_add(systq, &xa->task);
+ } else {
+ /* we can already sleep for memory */
atascsi_disk_unmap_task(xs, NULL);
- else if (workq_add_task(NULL, 0, atascsi_disk_unmap_task,
- xs, NULL) != 0) {
- atascsi_done(xs, XS_DRIVER_STUFFUP);
- return;
}
}
diff --git a/sys/dev/ata/atascsi.h b/sys/dev/ata/atascsi.h
index 24c8bb47fd1..6348466c93a 100644
--- a/sys/dev/ata/atascsi.h
+++ b/sys/dev/ata/atascsi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.h,v 1.47 2011/07/08 07:43:05 dlg Exp $ */
+/* $OpenBSD: atascsi.h,v 1.48 2013/12/09 11:44:52 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -21,6 +21,8 @@
#ifndef _DEV_ATA_ATASCSI_H_
#define _DEV_ATA_ATASCSI_H_
+#include <sys/task.h>
+
struct atascsi;
struct scsi_link;
@@ -302,6 +304,7 @@ struct ata_xfer {
size_t resid;
void (*complete)(struct ata_xfer *);
+ struct task task;
struct timeout stimeout;
u_int timeout;