Skip to content

Commit 640c167

Browse files
Josef 'Jeff' Sipekrmustacc
authored andcommitted
5047 don't use atomic_*_nv if you discard the return value
Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
1 parent 9c68c05 commit 640c167

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

usr/src/uts/common/fs/zfs/dbuf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ dbuf_clear(dmu_buf_impl_t *db)
16051605
dndb = dn->dn_dbuf;
16061606
if (db->db_blkid != DMU_BONUS_BLKID && MUTEX_HELD(&dn->dn_dbufs_mtx)) {
16071607
avl_remove(&dn->dn_dbufs, db);
1608-
(void) atomic_dec_32_nv(&dn->dn_dbufs_count);
1608+
atomic_dec_32(&dn->dn_dbufs_count);
16091609
membar_producer();
16101610
DB_DNODE_EXIT(db);
16111611
/*
@@ -1781,7 +1781,7 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid,
17811781
ASSERT(dn->dn_object == DMU_META_DNODE_OBJECT ||
17821782
refcount_count(&dn->dn_holds) > 0);
17831783
(void) refcount_add(&dn->dn_holds, db);
1784-
(void) atomic_inc_32_nv(&dn->dn_dbufs_count);
1784+
atomic_inc_32(&dn->dn_dbufs_count);
17851785

17861786
dprintf_dbuf(db, "db=%p\n", db);
17871787

@@ -1827,7 +1827,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
18271827
dn = DB_DNODE(db);
18281828
mutex_enter(&dn->dn_dbufs_mtx);
18291829
avl_remove(&dn->dn_dbufs, db);
1830-
(void) atomic_dec_32_nv(&dn->dn_dbufs_count);
1830+
atomic_dec_32(&dn->dn_dbufs_count);
18311831
mutex_exit(&dn->dn_dbufs_mtx);
18321832
DB_DNODE_EXIT(db);
18331833
/*
@@ -2111,7 +2111,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag)
21112111
* until the move completes.
21122112
*/
21132113
DB_DNODE_ENTER(db);
2114-
(void) atomic_dec_32_nv(&DB_DNODE(db)->dn_dbufs_count);
2114+
atomic_dec_32(&DB_DNODE(db)->dn_dbufs_count);
21152115
DB_DNODE_EXIT(db);
21162116
/*
21172117
* The bonus buffer's dnode hold is no longer discounted

usr/src/uts/common/fs/zfs/dmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp)
284284
/* as long as the bonus buf is held, the dnode will be held */
285285
if (refcount_add(&db->db_holds, tag) == 1) {
286286
VERIFY(dnode_add_ref(dn, db));
287-
(void) atomic_inc_32_nv(&dn->dn_dbufs_count);
287+
atomic_inc_32(&dn->dn_dbufs_count);
288288
}
289289

290290
/*

usr/src/uts/common/inet/sctp/sctp_addr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ sctp_ipif_inactive(sctp_ipif_t *sctp_ipif)
137137
rw_destroy(&sctp_ipif->sctp_ipif_lock);
138138
kmem_free(sctp_ipif, sizeof (sctp_ipif_t));
139139

140-
(void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt);
140+
atomic_dec_32(&sctp_ill->sctp_ill_ipifcnt);
141141
if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) {
142142
rw_downgrade(&sctps->sctps_g_ipifs_lock);
143143
if (sctp_ill->sctp_ill_ipifcnt == 0 &&
@@ -884,7 +884,7 @@ sctp_move_ipif(ipif_t *ipif, ill_t *f_ill, ill_t *t_ill)
884884
ASSERT(sctp_ipif->sctp_ipif_ill == fsctp_ill);
885885
sctp_ipif->sctp_ipif_ill = tsctp_ill;
886886
rw_exit(&sctp_ipif->sctp_ipif_lock);
887-
(void) atomic_dec_32_nv(&fsctp_ill->sctp_ill_ipifcnt);
887+
atomic_dec_32(&fsctp_ill->sctp_ill_ipifcnt);
888888
atomic_inc_32(&tsctp_ill->sctp_ill_ipifcnt);
889889
rw_exit(&sctps->sctps_g_ipifs_lock);
890890
rw_exit(&sctps->sctps_g_ills_lock);
@@ -1097,7 +1097,7 @@ sctp_update_ipif_addr(ipif_t *ipif, in6_addr_t v6addr)
10971097
sctps->sctps_g_ipifs_count--;
10981098
rw_destroy(&osctp_ipif->sctp_ipif_lock);
10991099
kmem_free(osctp_ipif, sizeof (sctp_ipif_t));
1100-
(void) atomic_dec_32_nv(&osctp_ill->sctp_ill_ipifcnt);
1100+
atomic_dec_32(&osctp_ill->sctp_ill_ipifcnt);
11011101
}
11021102
}
11031103

@@ -1209,7 +1209,7 @@ sctp_update_ipif(ipif_t *ipif, int op)
12091209
sctps->sctps_g_ipifs_count--;
12101210
rw_destroy(&sctp_ipif->sctp_ipif_lock);
12111211
kmem_free(sctp_ipif, sizeof (sctp_ipif_t));
1212-
(void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt);
1212+
atomic_dec_32(&sctp_ill->sctp_ill_ipifcnt);
12131213
if (rw_tryupgrade(&sctps->sctps_g_ills_lock) != 0) {
12141214
rw_downgrade(&sctps->sctps_g_ipifs_lock);
12151215
if (sctp_ill->sctp_ill_ipifcnt == 0 &&
@@ -2029,7 +2029,7 @@ sctp_free_ipifs(sctp_stack_t *sctps)
20292029
list_remove(&sctps->sctps_g_ipifs[i].sctp_ipif_list,
20302030
sctp_ipif);
20312031
sctps->sctps_g_ipifs_count--;
2032-
(void) atomic_dec_32_nv(&sctp_ill->sctp_ill_ipifcnt);
2032+
atomic_dec_32(&sctp_ill->sctp_ill_ipifcnt);
20332033
kmem_free(sctp_ipif, sizeof (sctp_ipif_t));
20342034
sctp_ipif =
20352035
list_tail(&sctps->sctps_g_ipifs[i].sctp_ipif_list);

usr/src/uts/common/io/comstar/port/fct/discovery.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ fct_register_remote_port(fct_local_port_t *port, fct_remote_port_t *rp,
11601160
iport->iport_rp_slots[rp->rp_handle] = irp;
11611161
atomic_or_32(&irp->irp_flags, IRP_HANDLE_OPENED);
11621162
}
1163-
(void) atomic_inc_64_nv(&iport->iport_last_change);
1163+
atomic_inc_64(&iport->iport_last_change);
11641164
fct_log_remote_port_event(port, ESC_SUNFC_TARGET_ADD,
11651165
rp->rp_pwwn, rp->rp_id);
11661166

@@ -1205,7 +1205,7 @@ fct_deregister_remote_port(fct_local_port_t *port, fct_remote_port_t *rp)
12051205
atomic_and_32(&irp->irp_flags, ~IRP_HANDLE_OPENED);
12061206
iport->iport_rp_slots[rp->rp_handle] = NULL;
12071207
}
1208-
(void) atomic_inc_64_nv(&iport->iport_last_change);
1208+
atomic_inc_64(&iport->iport_last_change);
12091209
fct_log_remote_port_event(port, ESC_SUNFC_TARGET_REMOVE,
12101210
rp->rp_pwwn, rp->rp_id);
12111211

usr/src/uts/common/io/trill.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ trill_node_unref(trill_inst_t *tip, trill_node_t *tnp)
11131113
if (tnp->tn_tsp != NULL)
11141114
trill_sock_unref(tnp->tn_tsp);
11151115
trill_node_free(tnp);
1116-
(void) atomic_dec_uint_nv(&tip->ti_nodecount);
1116+
atomic_dec_uint(&tip->ti_nodecount);
11171117
}
11181118
}
11191119

usr/src/uts/i86pc/os/cmi_hw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ cmi_hdl_rele(cmi_hdl_t ophdl)
14201420
cmi_hdl_impl_t *hdl = IMPLHDL(ophdl);
14211421

14221422
ASSERT(*hdl->cmih_refcntp > 0);
1423-
(void) atomic_dec_32_nv(hdl->cmih_refcntp);
1423+
atomic_dec_32(hdl->cmih_refcntp);
14241424
}
14251425

14261426
void
@@ -1431,7 +1431,7 @@ cmi_hdl_destroy(cmi_hdl_t ophdl)
14311431

14321432
/* Release the reference count held by cmi_hdl_create(). */
14331433
ASSERT(*hdl->cmih_refcntp > 0);
1434-
(void) atomic_dec_32_nv(hdl->cmih_refcntp);
1434+
atomic_dec_32(hdl->cmih_refcntp);
14351435
hdl->cmih_flags |= CMIH_F_DEAD;
14361436

14371437
ent = cmi_hdl_ent_lookup(hdl->cmih_chipid, hdl->cmih_coreid,

0 commit comments

Comments
 (0)