Internal scheduling priorities: Always use symbolic ones

Replace priorities specified by a base priority and some hardcoded
offset value by symbolic constants.  Hardcoded offsets prevent changing
the difference between priorities without changing their relative
ordering, and is generally a dangerous practice since the resulting
priority may inadvertently belong to a different selection policy's
range.

Since RQ_PPQ is 4, differences of less than 4 are insignificant, so just
remove them.  These small differences have not been changed for years,
so it is likely they have no real meaning (besides having no practical
effect).  One can still consult the changes history to recover them if
ever needed.

No functional change (intended).

MFC after:      1 month
Event:          Kitchener-Waterloo Hackathon 202506
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45390

(cherry picked from commit 8ecc41918066422d6788a67251b22d11a6efeddf)
This commit is contained in:
Olivier Certner 2024-05-22 17:29:22 +02:00 committed by Franco Fichtner
parent 00aae357b5
commit a29140025a
27 changed files with 65 additions and 66 deletions

View file

@ -13424,7 +13424,7 @@ ctl_work_thread(void *arg)
CTL_DEBUG_PRINT(("ctl_work_thread starting\n"));
thread_lock(curthread);
sched_prio(curthread, PUSER - 1);
sched_prio(curthread, PRI_MAX_KERN);
thread_unlock(curthread);
while (!softc->shutdown) {
@ -13494,7 +13494,7 @@ ctl_thresh_thread(void *arg)
CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n"));
thread_lock(curthread);
sched_prio(curthread, PUSER - 1);
sched_prio(curthread, PRI_MAX_KERN);
thread_unlock(curthread);
while (!softc->shutdown) {

View file

@ -293,7 +293,7 @@ extern int firewire_debug;
extern devclass_t firewire_devclass;
extern int firewire_phydma_enable;
#define FWPRI ((PZERO + 8) | PCATCH)
#define FWPRI (PWAIT | PCATCH)
#define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */)

View file

@ -32,7 +32,7 @@
#include <dev/iicbus/iic.h>
#define IICPRI (PZERO+8) /* XXX sleep/wakeup queue priority */
#define IICPRI (PWAIT) /* XXX sleep/wakeup queue priority */
#define LSB 0x1

View file

@ -100,7 +100,7 @@ static int volatile lptflag = 1;
#define LPINITRDY 4 /* wait up to 4 seconds for a ready */
#define LPTOUTINITIAL 10 /* initial timeout to wait for ready 1/10 s */
#define LPTOUTMAX 1 /* maximal timeout 1 s */
#define LPPRI (PZERO+8)
#define LPPRI (PWAIT)
#define BUFSIZE 1024
#define BUFSTATSIZE 32

View file

@ -63,7 +63,7 @@
/*
* Parallel Port Bus sleep/wakeup queue.
*/
#define PPBPRI (PZERO+8)
#define PPBPRI (PWAIT)
/*
* Parallel Port Chipset mode masks.

View file

@ -30,7 +30,7 @@
#include <sys/queue.h>
#define SMBPRI (PZERO+8) /* XXX sleep/wakeup queue priority */
#define SMBPRI (PWAIT) /* XXX sleep/wakeup queue priority */
#define n(flags) (~(flags) & (flags))

View file

@ -1310,7 +1310,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
if (i == sc->cur_scp->index)
return 0;
error =
tsleep(VTY_WCHAN(sc, i), (PZERO + 1) | PCATCH, "waitvt", 0);
tsleep(VTY_WCHAN(sc, i), PZERO | PCATCH, "waitvt", 0);
return error;
case VT_GETACTIVE: /* get active vty # */

View file

@ -82,7 +82,7 @@ MALLOC_DEFINE(M_VKBD, KEYBOARD_NAME, "Virtual AT keyboard");
#define VKBD_UNLOCK(s) mtx_unlock(&(s)->ks_lock)
#define VKBD_LOCK_ASSERT(s, w) mtx_assert(&(s)->ks_lock, w)
#define VKBD_SLEEP(s, f, d, t) \
msleep(&(s)->f, &(s)->ks_lock, PCATCH | (PZERO + 1), d, t)
msleep(&(s)->f, &(s)->ks_lock, PCATCH | PZERO, d, t)
#else
#define VKBD_LOCK_DECL
#define VKBD_LOCK_INIT(s)
@ -90,7 +90,7 @@ MALLOC_DEFINE(M_VKBD, KEYBOARD_NAME, "Virtual AT keyboard");
#define VKBD_LOCK(s)
#define VKBD_UNLOCK(s)
#define VKBD_LOCK_ASSERT(s, w)
#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | (PZERO + 1), d, t)
#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | PZERO, d, t)
#endif
#define VKBD_KEYBOARD(d) \
@ -268,8 +268,8 @@ vkbd_dev_close(struct cdev *dev, int foo, int bar, struct thread *td)
VKBD_SLEEP(state, ks_task, "vkbdc", 0);
/* wakeup poll()ers */
selwakeuppri(&state->ks_rsel, PZERO + 1);
selwakeuppri(&state->ks_wsel, PZERO + 1);
selwakeuppri(&state->ks_rsel, PZERO);
selwakeuppri(&state->ks_wsel, PZERO);
state->ks_flags &= ~OPEN;
state->ks_dev = NULL;
@ -498,7 +498,7 @@ vkbd_status_changed(vkbd_state_t *state)
if (!(state->ks_flags & STATUS)) {
state->ks_flags |= STATUS;
selwakeuppri(&state->ks_rsel, PZERO + 1);
selwakeuppri(&state->ks_rsel, PZERO);
wakeup(&state->ks_flags);
}
}
@ -531,7 +531,7 @@ vkbd_data_read(vkbd_state_t *state, int wait)
q->head = 0;
/* wakeup ks_inq writers/poll()ers */
selwakeuppri(&state->ks_wsel, PZERO + 1);
selwakeuppri(&state->ks_wsel, PZERO);
wakeup(q);
return (c);
@ -1246,7 +1246,7 @@ vkbd_clear_state_locked(vkbd_state_t *state)
/* flush ks_inq and wakeup writers/poll()ers */
state->ks_inq.head = state->ks_inq.tail = state->ks_inq.cc = 0;
selwakeuppri(&state->ks_wsel, PZERO + 1);
selwakeuppri(&state->ks_wsel, PZERO);
wakeup(&state->ks_inq);
}

View file

@ -153,7 +153,7 @@ fdata_dtor(void *arg)
FUSE_LOCK();
fuse_lck_mtx_lock(fdata->aw_mtx);
/* wakup poll()ers */
selwakeuppri(&fdata->ks_rsel, PZERO + 1);
selwakeuppri(&fdata->ks_rsel, PZERO);
/* Don't let syscall handlers wait in vain */
while ((tick = fuse_aw_pop(fdata))) {
fuse_lck_mtx_lock(tick->tk_aw_mtx);

View file

@ -933,7 +933,7 @@ fuse_io_invalbuf(struct vnode *vp, struct thread *td)
if (vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF)
return EIO;
fvdat->flag |= FN_FLUSHWANT;
tsleep(&fvdat->flag, PRIBIO + 2, "fusevinv", 2 * hz);
tsleep(&fvdat->flag, PRIBIO, "fusevinv", 2 * hz);
error = 0;
if (p != NULL) {
PROC_LOCK(p);

View file

@ -594,7 +594,7 @@ fdata_set_dead(struct fuse_data *data)
fuse_lck_mtx_lock(data->ms_mtx);
data->dataflags |= FSESS_DEAD;
wakeup_one(data);
selwakeuppri(&data->ks_rsel, PZERO + 1);
selwakeuppri(&data->ks_rsel, PZERO);
wakeup(&data->ticketer);
fuse_lck_mtx_unlock(data->ms_mtx);
FUSE_UNLOCK();
@ -670,7 +670,7 @@ fuse_insert_message(struct fuse_ticket *ftick, bool urgent)
else
fuse_ms_push(ftick);
wakeup_one(ftick->tk_data);
selwakeuppri(&ftick->tk_data->ks_rsel, PZERO + 1);
selwakeuppri(&ftick->tk_data->ks_rsel, PZERO);
KNOTE_LOCKED(&ftick->tk_data->ks_rsel.si_note, 0);
fuse_lck_mtx_unlock(ftick->tk_data->ms_mtx);
}

View file

@ -4670,7 +4670,7 @@ newnfs_sndlock(int *flagp)
ts.tv_sec = 0;
ts.tv_nsec = 0;
(void) nfsmsleep((caddr_t)flagp, NFSSOCKMUTEXPTR,
PZERO - 1, "nfsndlck", &ts);
PVFS, "nfsndlck", &ts);
}
*flagp |= NFSR_SNDLOCK;
NFSUNLOCKSOCK();

View file

@ -392,7 +392,7 @@ loop:
nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) {
if ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP,
(void)mtx_sleep(rp, mutex, PVFS | PDROP,
"nfsrc", 10 * hz);
goto loop;
}
@ -678,7 +678,7 @@ tryagain:
rp = hitrp;
if ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP,
(void)mtx_sleep(rp, mutex, PVFS | PDROP,
"nfsrc", 10 * hz);
goto tryagain;
}
@ -750,7 +750,7 @@ nfsrc_lock(struct nfsrvcache *rp)
mtx_assert(mutex, MA_OWNED);
while ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void)mtx_sleep(rp, mutex, PZERO - 1, "nfsrc", 0);
(void)mtx_sleep(rp, mutex, PVFS, "nfsrc", 0);
}
rp->rc_flag |= RC_LOCKED;
}

View file

@ -552,7 +552,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
*/
while (clp->lc_cbref) {
clp->lc_flags |= LCL_WAKEUPWANTED;
(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1,
(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS,
"nfsd clp", 10 * hz);
}
NFSUNLOCKSTATE();
@ -629,7 +629,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
NFSLOCKSTATE();
while (clp->lc_cbref) {
clp->lc_flags |= LCL_WAKEUPWANTED;
(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1,
(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS,
"nfsdclp", 10 * hz);
}
NFSUNLOCKSTATE();

View file

@ -629,7 +629,7 @@ smbfs_vinvalbuf(struct vnode *vp, struct thread *td)
while (np->n_flag & NFLUSHINPROG) {
np->n_flag |= NFLUSHWANT;
error = tsleep(&np->n_flag, PRIBIO + 2, "smfsvinv", 2 * hz);
error = tsleep(&np->n_flag, PRIBIO, "smfsvinv", 2 * hz);
error = smb_td_intr(td);
if (error == EINTR)
return EINTR;

View file

@ -1010,7 +1010,8 @@ rms_rlock_fallback(struct rmslock *rms)
mtx_lock(&rms->mtx);
while (rms->writers > 0)
msleep(&rms->readers, &rms->mtx, PUSER - 1, mtx_name(&rms->mtx), 0);
msleep(&rms->readers, &rms->mtx, PRI_MAX_KERN,
mtx_name(&rms->mtx), 0);
critical_enter();
rms_int_readers_inc(rms, rms_int_pcpu(rms));
mtx_unlock(&rms->mtx);
@ -1197,7 +1198,7 @@ rms_wlock(struct rmslock *rms)
mtx_lock(&rms->mtx);
rms->writers++;
if (rms->writers > 1) {
msleep(&rms->owner, &rms->mtx, (PUSER - 1),
msleep(&rms->owner, &rms->mtx, PRI_MAX_KERN,
mtx_name(&rms->mtx), 0);
MPASS(rms->readers == 0);
KASSERT(rms->owner == RMS_TRANSIENT,
@ -1213,7 +1214,7 @@ rms_wlock(struct rmslock *rms)
rms_assert_no_pcpu_readers(rms);
if (rms->readers > 0) {
msleep(&rms->writers, &rms->mtx, (PUSER - 1),
msleep(&rms->writers, &rms->mtx, PRI_MAX_KERN,
mtx_name(&rms->mtx), 0);
}

View file

@ -50,7 +50,7 @@
#include <sys/filedesc.h>
#include <sys/sysctl.h>
#define LOG_RDPRI (PZERO + 1)
#define LOG_RDPRI PZERO
#define LOG_ASYNC 0x04

View file

@ -893,7 +893,7 @@ kern_msgsnd(struct thread *td, int msqid, const void *msgp,
we_own_it = 1;
}
DPRINTF(("msgsnd: goodnight\n"));
error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH,
"msgsnd", hz);
DPRINTF(("msgsnd: good morning, error=%d\n", error));
if (we_own_it)
@ -1302,7 +1302,7 @@ kern_msgrcv(struct thread *td, int msqid, void *msgp, size_t msgsz, long msgtyp,
*/
DPRINTF(("msgrcv: goodnight\n"));
error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH,
"msgrcv", 0);
DPRINTF(("msgrcv: good morning (error=%d)\n", error));

View file

@ -1308,7 +1308,7 @@ kern_semop(struct thread *td, int usemid, struct sembuf *usops,
semptr->semncnt++;
DPRINTF(("semop: good night!\n"));
error = msleep_sbt(semakptr, sema_mtxp, (PZERO - 4) | PCATCH,
error = msleep_sbt(semakptr, sema_mtxp, PVFS | PCATCH,
"semwait", sbt, precision, C_ABSOLUTE);
DPRINTF(("semop: good morning (error=%d)!\n", error));
/* return code is checked below, after sem[nz]cnt-- */

View file

@ -754,7 +754,7 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags,
break;
}
error = msleep(&bd->bd_wanted, BD_LOCKPTR(bd),
(PRIBIO + 4) | slpflag, "newbuf", slptimeo);
PVFS | slpflag, "newbuf", slptimeo);
if (error != 0)
break;
}
@ -2653,8 +2653,7 @@ bwillwrite(void)
mtx_lock(&bdirtylock);
while (buf_dirty_count_severe()) {
bdirtywait = 1;
msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4),
"flswai", 0);
msleep(&bdirtywait, &bdirtylock, PVFS, "flswai", 0);
}
mtx_unlock(&bdirtylock);
}
@ -5214,7 +5213,7 @@ bufobj_wwait(struct bufobj *bo, int slpflag, int timeo)
while (bo->bo_numoutput) {
bo->bo_flag |= BO_WWAIT;
error = msleep(&bo->bo_numoutput, BO_LOCKPTR(bo),
slpflag | (PRIBIO + 1), "bo_wwait", timeo);
slpflag | PRIBIO, "bo_wwait", timeo);
if (error)
break;
}

View file

@ -789,7 +789,7 @@ foffset_lock(struct file *fp, int flags)
}
DROP_GIANT();
sleepq_add(&fp->f_vnread_flags, NULL, "vofflock", 0, 0);
sleepq_wait(&fp->f_vnread_flags, PUSER -1);
sleepq_wait(&fp->f_vnread_flags, PRI_MAX_KERN);
PICKUP_GIANT();
sleepq_lock(&fp->f_vnread_flags);
state = atomic_load_16(flagsp);
@ -851,7 +851,7 @@ foffset_lock(struct file *fp, int flags)
if ((flags & FOF_NOLOCK) == 0) {
while (fp->f_vnread_flags & FOFFSET_LOCKED) {
fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
msleep(&fp->f_vnread_flags, mtxp, PRI_MAX_KERN,
"vofflock", 0);
}
fp->f_vnread_flags |= FOFFSET_LOCKED;
@ -1919,7 +1919,7 @@ vn_start_write_refed(struct mount *mp, int flags, bool mplocked)
if (flags & V_PCATCH)
mflags |= PCATCH;
}
mflags |= (PUSER - 1);
mflags |= PRI_MAX_KERN;
while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) {
if ((flags & V_NOWAIT) != 0) {
error = EWOULDBLOCK;
@ -2044,7 +2044,7 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags)
if ((flags & V_PCATCH) != 0)
mflags |= PCATCH;
}
mflags |= (PUSER - 1) | PDROP;
mflags |= PRI_MAX_KERN | PDROP;
error = msleep(&mp->mnt_flag, MNT_MTX(mp), mflags, "suspfs", 0);
vfs_rel(mp);
if (error == 0)
@ -2129,7 +2129,7 @@ vfs_write_suspend(struct mount *mp, int flags)
return (EALREADY);
}
while (mp->mnt_kern_flag & MNTK_SUSPEND)
msleep(&mp->mnt_flag, MNT_MTX(mp), PUSER - 1, "wsuspfs", 0);
msleep(&mp->mnt_flag, MNT_MTX(mp), PRI_MAX_KERN, "wsuspfs", 0);
/*
* Unmount holds a write reference on the mount point. If we
@ -2150,7 +2150,7 @@ vfs_write_suspend(struct mount *mp, int flags)
mp->mnt_susp_owner = curthread;
if (mp->mnt_writeopcount > 0)
(void) msleep(&mp->mnt_writeopcount,
MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0);
MNT_MTX(mp), PRI_MAX_KERN | PDROP, "suspwt", 0);
else
MNT_IUNLOCK(mp);
if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) {

View file

@ -866,7 +866,7 @@ tunstart(struct ifnet *ifp)
tp->tun_flags &= ~TUN_RWAIT;
wakeup(tp);
}
selwakeuppri(&tp->tun_rsel, PZERO + 1);
selwakeuppri(&tp->tun_rsel, PZERO);
KNOTE_LOCKED(&tp->tun_rsel.si_note, 0);
if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) {
TUN_UNLOCK(tp);
@ -927,7 +927,7 @@ tunstart_l2(struct ifnet *ifp)
TUN_LOCK(tp);
}
selwakeuppri(&tp->tun_rsel, PZERO+1);
selwakeuppri(&tp->tun_rsel, PZERO);
KNOTE_LOCKED(&tp->tun_rsel.si_note, 0);
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* obytes are counted in ether_output */
}
@ -1201,7 +1201,7 @@ out:
CURVNET_RESTORE();
funsetown(&tp->tun_sigio);
selwakeuppri(&tp->tun_rsel, PZERO + 1);
selwakeuppri(&tp->tun_rsel, PZERO);
KNOTE_LOCKED(&tp->tun_rsel.si_note, 0);
TUNDEBUG (ifp, "closed\n");
tp->tun_flags &= ~TUN_OPEN;
@ -1735,7 +1735,7 @@ tunread(struct cdev *dev, struct uio *uio, int flag)
return (EWOULDBLOCK);
}
tp->tun_flags |= TUN_RWAIT;
error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1),
error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | PZERO,
"tunread", 0);
if (error != 0) {
TUN_UNLOCK(tp);

View file

@ -462,7 +462,7 @@ ngdread(struct cdev *dev, struct uio *uio, int flag)
mtx_lock(&priv->ngd_mtx);
priv->flags |= NGDF_RWAIT;
if ((error = msleep(priv, &priv->ngd_mtx,
PDROP | PCATCH | (PZERO + 1),
PDROP | PCATCH | PZERO,
"ngdread", 0)) != 0)
return (error);
}

View file

@ -298,7 +298,7 @@ struct buf {
* Initialize a lock.
*/
#define BUF_LOCKINIT(bp, wmesg) \
lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW)
lockinit(&(bp)->b_lock, PVFS, wmesg, 0, LK_NEW)
/*
*
* Get a lock sleeping non-interruptably until it becomes available.
@ -313,7 +313,7 @@ struct buf {
*/
#define BUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo) \
_lockmgr_args_rw(&(bp)->b_lock, (locktype) | LK_TIMELOCK, \
(interlock), (wmesg), (PRIBIO + 4) | (catch), (timo), \
(interlock), (wmesg), PVFS | (catch), (timo), \
LOCK_FILE, LOCK_LINE)
/*

View file

@ -499,7 +499,7 @@ softdep_check_suspend(struct mount *mp,
while (mp->mnt_secondary_writes != 0) {
BO_UNLOCK(bo);
msleep(&mp->mnt_secondary_writes, MNT_MTX(mp),
(PUSER - 1) | PDROP, "secwr", 0);
PRI_MAX_KERN | PDROP, "secwr", 0);
BO_LOCK(bo);
MNT_ILOCK(mp);
}
@ -14578,7 +14578,7 @@ softdep_check_suspend(struct mount *mp,
while (mp->mnt_secondary_writes != 0) {
BO_UNLOCK(bo);
msleep(&mp->mnt_secondary_writes, MNT_MTX(mp),
(PUSER - 1) | PDROP, "secwr", 0);
PRI_MAX_KERN | PDROP, "secwr", 0);
BO_LOCK(bo);
MNT_ILOCK(mp);
}
@ -14618,7 +14618,7 @@ softdep_check_suspend(struct mount *mp,
BO_UNLOCK(bo);
msleep(&mp->mnt_secondary_writes,
MNT_MTX(mp),
(PUSER - 1) | PDROP, "secwr", 0);
PRI_MAX_KERN | PDROP, "secwr", 0);
BO_LOCK(bo);
continue;
}

View file

@ -1402,8 +1402,7 @@ ffs_lock_ea(struct vnode *vp)
VI_LOCK(vp);
while (ip->i_flag & IN_EA_LOCKED) {
UFS_INODE_SET_FLAG(ip, IN_EA_LOCKWAIT);
msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD + 2, "ufs_ea",
0);
msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD, "ufs_ea", 0);
}
UFS_INODE_SET_FLAG(ip, IN_EA_LOCKED);
VI_UNLOCK(vp);

View file

@ -181,7 +181,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags)
if ((dq = ip->i_dquot[i]) == NODQUOT)
continue;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkdq1");
DQI_WAIT(dq, PINOD, "chkdq1");
ncurblocks = dq->dq_curblocks + change;
if (ncurblocks >= 0)
dq->dq_curblocks = ncurblocks;
@ -203,7 +203,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags)
continue;
warn = 0;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkdq2");
DQI_WAIT(dq, PINOD, "chkdq2");
if (do_check) {
error = chkdqchg(ip, change, cred, i, &warn);
if (error) {
@ -217,7 +217,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags)
if (dq == NODQUOT)
continue;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkdq3");
DQI_WAIT(dq, PINOD, "chkdq3");
ncurblocks = dq->dq_curblocks - change;
if (ncurblocks >= 0)
dq->dq_curblocks = ncurblocks;
@ -322,7 +322,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags)
if ((dq = ip->i_dquot[i]) == NODQUOT)
continue;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkiq1");
DQI_WAIT(dq, PINOD, "chkiq1");
if (dq->dq_curinodes >= -change)
dq->dq_curinodes += change;
else
@ -343,7 +343,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags)
continue;
warn = 0;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkiq2");
DQI_WAIT(dq, PINOD, "chkiq2");
if (do_check) {
error = chkiqchg(ip, change, cred, i, &warn);
if (error) {
@ -357,7 +357,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags)
if (dq == NODQUOT)
continue;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "chkiq3");
DQI_WAIT(dq, PINOD, "chkiq3");
if (dq->dq_curinodes >= change)
dq->dq_curinodes -= change;
else
@ -857,7 +857,7 @@ _setquota(struct thread *td, struct mount *mp, uint64_t id, int type,
return (error);
dq = ndq;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "setqta");
DQI_WAIT(dq, PINOD, "setqta");
/*
* Copy all but the current values.
* Reset time limit if previously had no soft limit or were
@ -920,7 +920,7 @@ _setuse(struct thread *td, struct mount *mp, uint64_t id, int type,
return (error);
dq = ndq;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "setuse");
DQI_WAIT(dq, PINOD, "setuse");
/*
* Reset time limit if have a soft limit and were
* previously under it, but are now over it.
@ -1316,7 +1316,7 @@ dqget(struct vnode *vp, uint64_t id, struct ufsmount *ump, int type,
if (dq != NULL) {
DQH_UNLOCK();
hfound: DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "dqget");
DQI_WAIT(dq, PINOD, "dqget");
DQI_UNLOCK(dq);
if (dq->dq_ump == NULL) {
dqrele(vp, dq);
@ -1590,7 +1590,7 @@ dqsync(struct vnode *vp, struct dquot *dq)
vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY);
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+2, "dqsync");
DQI_WAIT(dq, PINOD, "dqsync");
if ((dq->dq_flags & DQ_MOD) == 0)
goto out;
dq->dq_flags |= DQ_LOCK;
@ -1744,7 +1744,7 @@ quotaadj(struct dquot **qrp, struct ufsmount *ump, int64_t blkcount)
if ((dq = qrp[i]) == NODQUOT)
continue;
DQI_LOCK(dq);
DQI_WAIT(dq, PINOD+1, "adjqta");
DQI_WAIT(dq, PINOD, "adjqta");
ncurblocks = dq->dq_curblocks + blkcount;
if (ncurblocks >= 0)
dq->dq_curblocks = ncurblocks;