summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-01 15:06:26 +0000
committerphk <phk@FreeBSD.org>2003-04-01 15:06:26 +0000
commitc235e25328c6cf4b9091f38d9c18db15764df594 (patch)
treef08dda1f60d395e9bc94bf2fd1921768bf958c6d /sys/dev/ata
parent98acc8a3d79206dbf51e83ae8573fa89e54645b6 (diff)
downloadFreeBSD-src-c235e25328c6cf4b9091f38d9c18db15764df594.zip
FreeBSD-src-c235e25328c6cf4b9091f38d9c18db15764df594.tar.gz
Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now. Spell bioq_disksort() consistently with the remaining bioq_*(). #include <geom/geom_disk.h> where this is more appropriate.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/ata-all.c2
-rw-r--r--sys/dev/ata/ata-disk.c9
-rw-r--r--sys/dev/ata/ata-raid.c1
-rw-r--r--sys/dev/ata/atapi-cd.c11
-rw-r--r--sys/dev/ata/atapi-fd.c10
-rw-r--r--sys/dev/ata/atapi-tape.c6
6 files changed, 12 insertions, 27 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 8674a93..867670a 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -34,7 +34,6 @@
#include <sys/ata.h>
#include <sys/kernel.h>
#include <sys/conf.h>
-#include <sys/disk.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/bio.h>
@@ -47,6 +46,7 @@
#ifdef __alpha__
#include <machine/md_var.h>
#endif
+#include <geom/geom_disk.h>
#include <dev/ata/ata-all.h>
#include <dev/ata/ata-disk.h>
#include <dev/ata/ata-raid.h>
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index c7d80cb..9801c25 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -45,6 +45,7 @@
#include <machine/md_var.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <geom/geom_disk.h>
#include <dev/ata/ata-all.h>
#include <dev/ata/ata-pci.h>
#include <dev/ata/ata-disk.h>
@@ -217,7 +218,6 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */
{
struct ad_softc *adp = atadev->driver;
struct ad_request *request;
- struct bio *bp;
atadev->flags |= ATA_D_DETACHING;
ata_prtdev(atadev, "removed from configuration\n");
@@ -229,10 +229,7 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */
biofinish(request->bp, NULL, ENXIO);
ad_free(request);
}
- while ((bp = bioq_first(&adp->queue))) {
- bioq_remove(&adp->queue, bp);
- biofinish(bp, NULL, ENXIO);
- }
+ bioq_flush(&adp->queue, NULL, ENXIO);
disk_destroy(&adp->disk);
if (adp->flags & AD_F_RAID_SUBDISK)
@@ -288,7 +285,7 @@ adstrategy(struct bio *bp)
return;
}
s = splbio();
- bioqdisksort(&adp->queue, bp);
+ bioq_disksort(&adp->queue, bp);
splx(s);
ata_start(adp->device->channel);
}
diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c
index 9c90281..e895494 100644
--- a/sys/dev/ata/ata-raid.c
+++ b/sys/dev/ata/ata-raid.c
@@ -44,6 +44,7 @@
#include <sys/kthread.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <geom/geom_disk.h>
#include <dev/ata/ata-all.h>
#include <dev/ata/ata-pci.h>
#include <dev/ata/ata-disk.h>
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 8e0d5bc..751a2c4 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -193,17 +193,13 @@ acddetach(struct ata_device *atadev)
{
struct acd_softc *cdp = atadev->driver;
struct acd_devlist *entry;
- struct bio *bp;
int subdev;
if (cdp->changer_info) {
for (subdev = 0; subdev < cdp->changer_info->slots; subdev++) {
if (cdp->driver[subdev] == cdp)
continue;
- while ((bp = bioq_first(&cdp->driver[subdev]->queue))) {
- bioq_remove(&cdp->driver[subdev]->queue, bp);
- biofinish(bp, NULL, ENXIO);
- }
+ bioq_flush(&cdp->driver[subdev]->queue, NULL, ENXIO);
destroy_dev(cdp->driver[subdev]->dev);
while ((entry = TAILQ_FIRST(&cdp->driver[subdev]->dev_list))) {
destroy_dev(entry->dev);
@@ -217,8 +213,7 @@ acddetach(struct ata_device *atadev)
free(cdp->driver, M_ACD);
free(cdp->changer_info, M_ACD);
}
- while ((bp = bioq_first(&cdp->queue)))
- biofinish(bp, NULL, ENXIO);
+ bioq_flush(&cdp->queue, NULL, ENXIO);
while ((entry = TAILQ_FIRST(&cdp->dev_list))) {
destroy_dev(entry->dev);
TAILQ_REMOVE(&cdp->dev_list, entry, chain);
@@ -1100,7 +1095,7 @@ acdstrategy(struct bio *bp)
bp->bio_resid = bp->bio_bcount;
s = splbio();
- bioqdisksort(&cdp->queue, bp);
+ bioq_disksort(&cdp->queue, bp);
splx(s);
ata_start(cdp->device->channel);
}
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index 0da55dd..5772242 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -36,9 +36,9 @@
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
-#include <sys/disk.h>
#include <sys/cdio.h>
#include <machine/bus.h>
+#include <geom/geom_disk.h>
#include <dev/ata/ata-all.h>
#include <dev/ata/atapi-all.h>
#include <dev/ata/atapi-fd.h>
@@ -103,12 +103,8 @@ void
afddetach(struct ata_device *atadev)
{
struct afd_softc *fdp = atadev->driver;
- struct bio *bp;
- while ((bp = bioq_first(&fdp->queue))) {
- bioq_remove(&fdp->queue, bp);
- biofinish(bp, NULL, ENXIO);
- }
+ bioq_flush(&fdp->queue, NULL, ENXIO);
disk_destroy(&fdp->disk);
ata_free_name(atadev);
ata_free_lun(&afd_lun_map, fdp->lun);
@@ -283,7 +279,7 @@ afdstrategy(struct bio *bp)
}
s = splbio();
- bioqdisksort(&fdp->queue, bp);
+ bioq_disksort(&fdp->queue, bp);
splx(s);
ata_start(fdp->device->channel);
}
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 31bf97f..e21a0e6 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -145,12 +145,8 @@ void
astdetach(struct ata_device *atadev)
{
struct ast_softc *stp = atadev->driver;
- struct bio *bp;
- while ((bp = bioq_first(&stp->queue))) {
- bioq_remove(&stp->queue, bp);
- biofinish(bp, NULL, ENXIO);
- }
+ bioq_flush(&stp->queue, NULL, ENXIO);
destroy_dev(stp->dev1);
destroy_dev(stp->dev2);
devstat_remove_entry(stp->stats);
OpenPOWER on IntegriCloud