summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-23 14:45:04 +0000
committerphk <phk@FreeBSD.org>2004-09-23 14:45:04 +0000
commit1d992e18ece4d1afbb9979737399f54a6ab3f45a (patch)
treed162b233ba7eb4ff884229557e3d0f09ae56a759 /sys/kern
parent6c3df7485a180bd5080920d02822833b5b1a389b (diff)
downloadFreeBSD-src-1d992e18ece4d1afbb9979737399f54a6ab3f45a.zip
FreeBSD-src-1d992e18ece4d1afbb9979737399f54a6ab3f45a.tar.gz
Eliminate DEV_STRATEGY() macro: call dev_strategy() directly.
Make dev_strategy() handle errors and departing devices properly.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_physio.c2
-rw-r--r--sys/kern/vfs_aio.c2
-rw-r--r--sys/kern/vfs_bio.c15
3 files changed, 14 insertions, 5 deletions
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 803995c..a6d47e1 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -95,7 +95,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
goto doerror;
}
- DEV_STRATEGY(bp);
+ dev_strategy(bp);
if (uio->uio_rw == UIO_READ)
bwait(bp, PRIBIO, "physrd");
else
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 21bc101..b72e3c3 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1144,7 +1144,7 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
splx(s);
/* Perform transfer. */
- DEV_STRATEGY(bp);
+ dev_strategy(bp);
notify = 0;
s = splbio();
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index b2e73b9..853803c 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -3105,14 +3105,23 @@ dev_strategy(struct buf *bp)
bp->b_io.bio_done = bufdonebio;
bp->b_io.bio_caller2 = bp;
dev = bp->b_io.bio_dev;
- csw = devsw(dev);
KASSERT(dev->si_refcount > 0,
("dev_strategy on un-referenced struct cdev *(%s)",
devtoname(dev)));
dev_lock();
- dev->si_threadcount++;
+ csw = devsw(dev);
+ if (csw != NULL)
+ dev->si_threadcount++;
dev_unlock();
- (*devsw(bp->b_io.bio_dev)->d_strategy)(&bp->b_io);
+ if (csw == NULL) {
+ bp->b_error = ENXIO;
+ bp->b_ioflags = BIO_ERROR;
+ mtx_lock(&Giant); /* XXX: too defensive ? */
+ bufdone(bp);
+ mtx_unlock(&Giant); /* XXX: too defensive ? */
+ return;
+ }
+ (*csw->d_strategy)(&bp->b_io);
dev_lock();
dev->si_threadcount--;
dev_unlock();
OpenPOWER on IntegriCloud