aio_qphysio: Eliminate one instance of an out-of-range check that is
performed twice. Eliminate initialization that is already performed by _aio_aqueue. aio_physwakeup: Eliminate redundant synchronization that is already performed by bufdone.
This commit is contained in:
parent
3af9501ad5
commit
b92bb032d8
@ -952,7 +952,7 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
|
|||||||
struct aio_liojob *lj;
|
struct aio_liojob *lj;
|
||||||
int fd;
|
int fd;
|
||||||
int s;
|
int s;
|
||||||
int cnt, notify;
|
int notify;
|
||||||
|
|
||||||
cb = &aiocbe->uaiocb;
|
cb = &aiocbe->uaiocb;
|
||||||
fdp = p->p_fd;
|
fdp = p->p_fd;
|
||||||
@ -979,24 +979,13 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
|
|||||||
if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys)
|
if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
if ((cb->aio_nbytes > MAXPHYS) && (num_buf_aio >= max_buf_aio))
|
if (cb->aio_nbytes > MAXPHYS)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
ki = p->p_aioinfo;
|
ki = p->p_aioinfo;
|
||||||
if (ki->kaio_buffer_count >= ki->kaio_ballowed_count)
|
if (ki->kaio_buffer_count >= ki->kaio_ballowed_count)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
cnt = cb->aio_nbytes;
|
|
||||||
if (cnt > MAXPHYS)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Physical I/O is charged directly to the process, so we don't have to
|
|
||||||
* fake it.
|
|
||||||
*/
|
|
||||||
aiocbe->inputcharge = 0;
|
|
||||||
aiocbe->outputcharge = 0;
|
|
||||||
|
|
||||||
ki->kaio_buffer_count++;
|
ki->kaio_buffer_count++;
|
||||||
|
|
||||||
lj = aiocbe->lio;
|
lj = aiocbe->lio;
|
||||||
@ -1203,7 +1192,7 @@ _aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type)
|
|||||||
unsigned int fd;
|
unsigned int fd;
|
||||||
struct socket *so;
|
struct socket *so;
|
||||||
int s;
|
int s;
|
||||||
int error = 0;
|
int error;
|
||||||
int opcode;
|
int opcode;
|
||||||
struct aiocblist *aiocbe;
|
struct aiocblist *aiocbe;
|
||||||
struct aioproclist *aiop;
|
struct aioproclist *aiop;
|
||||||
@ -2201,11 +2190,8 @@ aio_physwakeup(struct buf *bp)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
struct kaioinfo *ki;
|
struct kaioinfo *ki;
|
||||||
struct aio_liojob *lj;
|
struct aio_liojob *lj;
|
||||||
int s;
|
|
||||||
s = splbio();
|
|
||||||
|
|
||||||
wakeup((caddr_t)bp);
|
wakeup((caddr_t)bp);
|
||||||
bp->b_flags |= B_DONE;
|
|
||||||
|
|
||||||
aiocbe = (struct aiocblist *)bp->b_spc;
|
aiocbe = (struct aiocblist *)bp->b_spc;
|
||||||
if (aiocbe) {
|
if (aiocbe) {
|
||||||
@ -2258,7 +2244,6 @@ aio_physwakeup(struct buf *bp)
|
|||||||
if (aiocbe->uaiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL)
|
if (aiocbe->uaiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL)
|
||||||
timeout(process_signal, aiocbe, 0);
|
timeout(process_signal, aiocbe, 0);
|
||||||
}
|
}
|
||||||
splx(s);
|
|
||||||
}
|
}
|
||||||
#endif /* VFS_AIO */
|
#endif /* VFS_AIO */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user