Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
*** 1542,1554 ****
* get it).
*/
if (throttle_write) {
if (sema_tryp(&cmap->cmap_throttle_sem) == 0) {
rw_exit(&sidp->sid_rwlock);
! atomic_add_32(&cmap->cmap_waiters, 1);
sema_p(&cmap->cmap_throttle_sem);
! atomic_add_32(&cmap->cmap_waiters, -1);
rw_enter(&sidp->sid_rwlock, RW_READER);
/*
* Now since we released the sid_rwlock the state may
* have transitioned underneath us. so check that again.
--- 1542,1554 ----
* get it).
*/
if (throttle_write) {
if (sema_tryp(&cmap->cmap_throttle_sem) == 0) {
rw_exit(&sidp->sid_rwlock);
! atomic_inc_32(&cmap->cmap_waiters);
sema_p(&cmap->cmap_throttle_sem);
! atomic_dec_32(&cmap->cmap_waiters);
rw_enter(&sidp->sid_rwlock, RW_READER);
/*
* Now since we released the sid_rwlock the state may
* have transitioned underneath us. so check that again.
*** 1678,1688 ****
sema_v(&cmap->cmap_throttle_sem);
return;
}
rw_exit(&sidp->sid_rwlock);
! atomic_add_64((uint64_t *)&cmap->cmap_nchunks, 1);
if ((cmap->cmap_maxsize != 0) &&
((cmap->cmap_nchunks * cmap->cmap_chunksz) > cmap->cmap_maxsize)) {
cmn_err(CE_WARN, "fssnap_write_taskq: snapshot %d (%s) has "
"reached the maximum backing file size specified (%llu "
--- 1678,1688 ----
sema_v(&cmap->cmap_throttle_sem);
return;
}
rw_exit(&sidp->sid_rwlock);
! atomic_inc_64((uint64_t *)&cmap->cmap_nchunks);
if ((cmap->cmap_maxsize != 0) &&
((cmap->cmap_nchunks * cmap->cmap_chunksz) > cmap->cmap_maxsize)) {
cmn_err(CE_WARN, "fssnap_write_taskq: snapshot %d (%s) has "
"reached the maximum backing file size specified (%llu "