Eliminate the acquisition and release of Giant within physio(). Remove

the spl calls.

Reviewed by: phk@
Discussed with: scottl@
This commit is contained in:
Alan Cox 2004-08-10 21:47:11 +00:00
parent 6306df6b89
commit fad44deea3

View File

@ -36,13 +36,10 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
{
int i;
int error;
int spl;
caddr_t sa;
u_int iolen;
struct buf *bp;
/* We cannot trust the device driver to hold Giant for us */
mtx_lock(&Giant);
/* Keep the process UPAGES from being swapped. XXX: why ? */
PHOLD(curproc);
@ -99,12 +96,10 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
}
DEV_STRATEGY(bp);
spl = splbio();
if (uio->uio_rw == UIO_READ)
bwait(bp, PRIBIO, "physrd");
else
bwait(bp, PRIBIO, "physwr");
splx(spl);
if (uio->uio_segflg == UIO_USERSPACE)
vunmapbuf(bp);
@ -125,6 +120,5 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
doerror:
relpbuf(bp, NULL);
PRELE(curproc);
mtx_unlock(&Giant);
return (error);
}