Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
@@ -522,20 +522,20 @@
errorq_dispatch(errorq_t *eqp, const void *data, size_t len, uint_t flag)
{
errorq_elem_t *eep, *old;
if (eqp == NULL || !(eqp->eq_flags & ERRORQ_ACTIVE)) {
- atomic_add_64(&errorq_lost, 1);
+ atomic_inc_64(&errorq_lost);
return; /* drop error if queue is uninitialized or disabled */
}
for (;;) {
int i, rval;
if ((i = errorq_availbit(eqp->eq_bitmap, eqp->eq_qlen,
eqp->eq_rotor)) == -1) {
- atomic_add_64(&eqp->eq_kstat.eqk_dropped.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_dropped.value.ui64);
return;
}
BT_ATOMIC_SET_EXCL(eqp->eq_bitmap, i, rval);
if (rval == 0) {
eqp->eq_rotor = i;
@@ -557,11 +557,11 @@
if (atomic_cas_ptr(&eqp->eq_pend, old, eep) == old)
break;
}
- atomic_add_64(&eqp->eq_kstat.eqk_dispatched.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_dispatched.value.ui64);
if (flag == ERRORQ_ASYNC && eqp->eq_id != NULL)
ddi_trigger_softintr(eqp->eq_id);
}
@@ -865,20 +865,20 @@
errorq_reserve(errorq_t *eqp)
{
errorq_elem_t *eqep;
if (eqp == NULL || !(eqp->eq_flags & ERRORQ_ACTIVE)) {
- atomic_add_64(&errorq_lost, 1);
+ atomic_inc_64(&errorq_lost);
return (NULL);
}
for (;;) {
int i, rval;
if ((i = errorq_availbit(eqp->eq_bitmap, eqp->eq_qlen,
eqp->eq_rotor)) == -1) {
- atomic_add_64(&eqp->eq_kstat.eqk_dropped.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_dropped.value.ui64);
return (NULL);
}
BT_ATOMIC_SET_EXCL(eqp->eq_bitmap, i, rval);
if (rval == 0) {
eqp->eq_rotor = i;
@@ -891,11 +891,11 @@
errorq_nvelem_t *eqnp = eqep->eqe_data;
nv_alloc_reset(eqnp->eqn_nva);
eqnp->eqn_nvl = fm_nvlist_create(eqnp->eqn_nva);
}
- atomic_add_64(&eqp->eq_kstat.eqk_reserved.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_reserved.value.ui64);
return (eqep);
}
/*
* Commit an errorq element (eqep) for dispatching.
@@ -906,11 +906,11 @@
errorq_commit(errorq_t *eqp, errorq_elem_t *eqep, uint_t flag)
{
errorq_elem_t *old;
if (eqep == NULL || !(eqp->eq_flags & ERRORQ_ACTIVE)) {
- atomic_add_64(&eqp->eq_kstat.eqk_commit_fail.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_commit_fail.value.ui64);
return;
}
for (;;) {
old = eqp->eq_pend;
@@ -919,11 +919,11 @@
if (atomic_cas_ptr(&eqp->eq_pend, old, eqep) == old)
break;
}
- atomic_add_64(&eqp->eq_kstat.eqk_committed.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_committed.value.ui64);
if (flag == ERRORQ_ASYNC && eqp->eq_id != NULL)
ddi_trigger_softintr(eqp->eq_id);
}
@@ -937,11 +937,11 @@
if (eqep == NULL || !(eqp->eq_flags & ERRORQ_ACTIVE))
return;
BT_ATOMIC_CLEAR(eqp->eq_bitmap, eqep - eqp->eq_elems);
- atomic_add_64(&eqp->eq_kstat.eqk_cancelled.value.ui64, 1);
+ atomic_inc_64(&eqp->eq_kstat.eqk_cancelled.value.ui64);
}
/*
* Write elements on the dump list of each nvlist errorq to the dump device.
* Upon reboot, fmd(1M) will extract and replay them for diagnosis.