summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/fs/specfs/spec_vnops.c20
-rw-r--r--sys/kern/kern_physio.c2
-rw-r--r--sys/kern/vfs_aio.c2
-rw-r--r--sys/kern/vfs_bio.c15
-rw-r--r--sys/sys/conf.h2
5 files changed, 16 insertions, 25 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index f1f8075..1d4a12a 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -476,7 +476,6 @@ static int
spec_xstrategy(struct vnode *vp, struct buf *bp)
{
struct mount *mp;
- struct cdevsw *dsw;
struct thread *td = curthread;
KASSERT(bp->b_iocmd == BIO_READ || bp->b_iocmd == BIO_WRITE,
@@ -508,23 +507,8 @@ spec_xstrategy(struct vnode *vp, struct buf *bp)
mp->mnt_stat.f_syncreads++;
}
}
- dsw = devsw(bp->b_dev);
- if (dsw == NULL) {
- bp->b_error = ENXIO;
- bp->b_ioflags |= BIO_ERROR;
- bufdone(bp);
- return (0);
- }
- KASSERT(dsw->d_strategy != NULL,
- ("No strategy on dev %s responsible for buffer %p\n",
- devtoname(bp->b_dev), bp));
-
- if (!(dsw->d_flags & D_NEEDGIANT)) {
- /* XXX: notyet DROP_GIANT(); */
- DEV_STRATEGY(bp);
- /* XXX: notyet PICKUP_GIANT(); */
- } else
- DEV_STRATEGY(bp);
+
+ dev_strategy(bp);
return (0);
}
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();
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index c714019..eed4b4b 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -160,8 +160,6 @@ typedef int dumper_t(
off_t offset, /* Byte-offset to write at. */
size_t length); /* Number of bytes to dump. */
-#define DEV_STRATEGY(bp) dev_strategy(bp)
-
#endif /* _KERNEL */
/*
OpenPOWER on IntegriCloud