Style cleanups. No functional changes.
This commit is contained in:
parent
46bf3fe5a6
commit
5340642a2e
@ -430,50 +430,42 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
|
||||
STR_mtx_bad_type);
|
||||
|
||||
do {
|
||||
if ((type) & MTX_SPIN) {
|
||||
/*
|
||||
* Easy cases of spin locks:
|
||||
*
|
||||
* 1) We already own the lock and will simply
|
||||
* recurse on it (if RLIKELY)
|
||||
* 1) We already own the lock and will simply recurse on it (if
|
||||
* RLIKELY)
|
||||
*
|
||||
* 2) The lock is free, we just get it
|
||||
*/
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
/*
|
||||
* Check for recursion, if we already
|
||||
* have this lock we just bump the
|
||||
* recursion count.
|
||||
* Check for recursion, if we already have this lock we
|
||||
* just bump the recursion count.
|
||||
*/
|
||||
if (mpp->mtx_lock == CURTHD) {
|
||||
mpp->mtx_recurse++;
|
||||
break; /* Done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (((type) & MTX_TOPHALF) == 0)
|
||||
if (((type) & MTX_TOPHALF) == 0) {
|
||||
/*
|
||||
* If an interrupt thread uses this
|
||||
* we must block interrupts here.
|
||||
* If an interrupt thread uses this we must block
|
||||
* interrupts here.
|
||||
*/
|
||||
_getlock_spin_block(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
else {
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
}
|
||||
_getlock_spin_block(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
/* Sleep locks */
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
_getlock_sleep(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
if ((type) & MTX_RLIKELY)
|
||||
_getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
else
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
done:
|
||||
WITNESS_ENTER(mpp, type, file, line);
|
||||
CTR5(KTR_LOCK, STR_mtx_enter_fmt,
|
||||
mpp->mtx_description, mpp, file, line,
|
||||
|
@ -610,32 +610,30 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
|
||||
STR_mtx_bad_type);
|
||||
|
||||
do {
|
||||
if ((type) & MTX_SPIN) {
|
||||
/*
|
||||
* Easy cases of spin locks:
|
||||
*
|
||||
* 1) We already own the lock and will simply
|
||||
* recurse on it (if RLIKELY)
|
||||
* 1) We already own the lock and will simply recurse on it (if
|
||||
* RLIKELY)
|
||||
*
|
||||
* 2) The lock is free, we just get it
|
||||
*/
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
/*
|
||||
* Check for recursion, if we already
|
||||
* have this lock we just bump the
|
||||
* recursion count.
|
||||
* Check for recursion, if we already have this
|
||||
* lock we just bump the recursion count.
|
||||
*/
|
||||
if (mpp->mtx_lock == CURTHD) {
|
||||
mpp->mtx_recurse++;
|
||||
break; /* Done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (((type) & MTX_TOPHALF) == 0) {
|
||||
/*
|
||||
* If an interrupt thread uses this
|
||||
* we must block interrupts here.
|
||||
* If an interrupt thread uses this we must block
|
||||
* interrupts here.
|
||||
*/
|
||||
if ((type) & MTX_FIRST) {
|
||||
ASS_IEN;
|
||||
@ -647,18 +645,15 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
(type) & MTX_HARDOPTS);
|
||||
}
|
||||
} else
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
/* Sleep locks */
|
||||
if ((type) & MTX_RLIKELY)
|
||||
_getlock_sleep(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
else
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
}
|
||||
} while (0);
|
||||
done:
|
||||
WITNESS_ENTER(mpp, type, file, line);
|
||||
CTR5(KTR_LOCK, STR_mtx_enter_fmt,
|
||||
mpp->mtx_description, mpp, file, line,
|
||||
|
@ -610,32 +610,30 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
|
||||
STR_mtx_bad_type);
|
||||
|
||||
do {
|
||||
if ((type) & MTX_SPIN) {
|
||||
/*
|
||||
* Easy cases of spin locks:
|
||||
*
|
||||
* 1) We already own the lock and will simply
|
||||
* recurse on it (if RLIKELY)
|
||||
* 1) We already own the lock and will simply recurse on it (if
|
||||
* RLIKELY)
|
||||
*
|
||||
* 2) The lock is free, we just get it
|
||||
*/
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
/*
|
||||
* Check for recursion, if we already
|
||||
* have this lock we just bump the
|
||||
* recursion count.
|
||||
* Check for recursion, if we already have this
|
||||
* lock we just bump the recursion count.
|
||||
*/
|
||||
if (mpp->mtx_lock == CURTHD) {
|
||||
mpp->mtx_recurse++;
|
||||
break; /* Done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (((type) & MTX_TOPHALF) == 0) {
|
||||
/*
|
||||
* If an interrupt thread uses this
|
||||
* we must block interrupts here.
|
||||
* If an interrupt thread uses this we must block
|
||||
* interrupts here.
|
||||
*/
|
||||
if ((type) & MTX_FIRST) {
|
||||
ASS_IEN;
|
||||
@ -647,18 +645,15 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
(type) & MTX_HARDOPTS);
|
||||
}
|
||||
} else
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
/* Sleep locks */
|
||||
if ((type) & MTX_RLIKELY)
|
||||
_getlock_sleep(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
else
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
}
|
||||
} while (0);
|
||||
done:
|
||||
WITNESS_ENTER(mpp, type, file, line);
|
||||
CTR5(KTR_LOCK, STR_mtx_enter_fmt,
|
||||
mpp->mtx_description, mpp, file, line,
|
||||
|
@ -241,16 +241,16 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
i = witness_spin_check;
|
||||
if (i != 0 && w->w_level < i) {
|
||||
mtx_exit(&w_mtx, MTX_SPIN);
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @ %s:%d"
|
||||
" already holding %s:%x",
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @"
|
||||
" %s:%d already holding %s:%x",
|
||||
m->mtx_description, w->w_level, file, line,
|
||||
spin_order_list[ffs(i)-1], i);
|
||||
}
|
||||
@ -278,7 +278,6 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
if ((m1 = LIST_FIRST(&p->p_heldmtx)) == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
if ((w1 = m1->mtx_witness) == w) {
|
||||
if (w->w_same_squawked || dup_ok(w))
|
||||
goto out;
|
||||
@ -369,8 +368,8 @@ witness_exit(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
@ -398,7 +397,6 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
struct proc *p;
|
||||
witness_t *w = m->mtx_witness;
|
||||
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_try_enter: "
|
||||
|
@ -241,16 +241,16 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
i = witness_spin_check;
|
||||
if (i != 0 && w->w_level < i) {
|
||||
mtx_exit(&w_mtx, MTX_SPIN);
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @ %s:%d"
|
||||
" already holding %s:%x",
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @"
|
||||
" %s:%d already holding %s:%x",
|
||||
m->mtx_description, w->w_level, file, line,
|
||||
spin_order_list[ffs(i)-1], i);
|
||||
}
|
||||
@ -278,7 +278,6 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
if ((m1 = LIST_FIRST(&p->p_heldmtx)) == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
if ((w1 = m1->mtx_witness) == w) {
|
||||
if (w->w_same_squawked || dup_ok(w))
|
||||
goto out;
|
||||
@ -369,8 +368,8 @@ witness_exit(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
@ -398,7 +397,6 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
struct proc *p;
|
||||
witness_t *w = m->mtx_witness;
|
||||
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_try_enter: "
|
||||
|
@ -241,16 +241,16 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
i = witness_spin_check;
|
||||
if (i != 0 && w->w_level < i) {
|
||||
mtx_exit(&w_mtx, MTX_SPIN);
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @ %s:%d"
|
||||
" already holding %s:%x",
|
||||
panic("mutex_enter(%s:%x, MTX_SPIN) out of order @"
|
||||
" %s:%d already holding %s:%x",
|
||||
m->mtx_description, w->w_level, file, line,
|
||||
spin_order_list[ffs(i)-1], i);
|
||||
}
|
||||
@ -278,7 +278,6 @@ witness_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
if ((m1 = LIST_FIRST(&p->p_heldmtx)) == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
if ((w1 = m1->mtx_witness) == w) {
|
||||
if (w->w_same_squawked || dup_ok(w))
|
||||
goto out;
|
||||
@ -369,8 +368,8 @@ witness_exit(mtx_t *m, int flags, const char *file, int line)
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @ %s:%d",
|
||||
m->mtx_description, file, line);
|
||||
panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @"
|
||||
" %s:%d", m->mtx_description, file, line);
|
||||
if (m->mtx_recurse != 0)
|
||||
return;
|
||||
mtx_enter(&w_mtx, MTX_SPIN);
|
||||
@ -398,7 +397,6 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line)
|
||||
struct proc *p;
|
||||
witness_t *w = m->mtx_witness;
|
||||
|
||||
|
||||
if (flags & MTX_SPIN) {
|
||||
if (!w->w_spin)
|
||||
panic("mutex_try_enter: "
|
||||
|
@ -430,50 +430,42 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line)
|
||||
MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
|
||||
STR_mtx_bad_type);
|
||||
|
||||
do {
|
||||
if ((type) & MTX_SPIN) {
|
||||
/*
|
||||
* Easy cases of spin locks:
|
||||
*
|
||||
* 1) We already own the lock and will simply
|
||||
* recurse on it (if RLIKELY)
|
||||
* 1) We already own the lock and will simply recurse on it (if
|
||||
* RLIKELY)
|
||||
*
|
||||
* 2) The lock is free, we just get it
|
||||
*/
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
/*
|
||||
* Check for recursion, if we already
|
||||
* have this lock we just bump the
|
||||
* recursion count.
|
||||
* Check for recursion, if we already have this lock we
|
||||
* just bump the recursion count.
|
||||
*/
|
||||
if (mpp->mtx_lock == CURTHD) {
|
||||
mpp->mtx_recurse++;
|
||||
break; /* Done */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (((type) & MTX_TOPHALF) == 0)
|
||||
if (((type) & MTX_TOPHALF) == 0) {
|
||||
/*
|
||||
* If an interrupt thread uses this
|
||||
* we must block interrupts here.
|
||||
* If an interrupt thread uses this we must block
|
||||
* interrupts here.
|
||||
*/
|
||||
_getlock_spin_block(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
else {
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
}
|
||||
_getlock_spin_block(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
/* Sleep locks */
|
||||
if ((type) & MTX_RLIKELY) {
|
||||
_getlock_sleep(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
} else {
|
||||
_getlock_norecurse(mpp, CURTHD,
|
||||
(type) & MTX_HARDOPTS);
|
||||
if ((type) & MTX_RLIKELY)
|
||||
_getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
else
|
||||
_getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
done:
|
||||
WITNESS_ENTER(mpp, type, file, line);
|
||||
CTR5(KTR_LOCK, STR_mtx_enter_fmt,
|
||||
mpp->mtx_description, mpp, file, line,
|
||||
|
Loading…
Reference in New Issue
Block a user