Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 364,374 **** mutex_exit(&xnfp->xnf_gref_lock); if (gref == INVALID_GRANT_REF) { xnfp->xnf_stat_gref_failure++; } else { ! atomic_add_64(&xnfp->xnf_stat_gref_outstanding, 1); if (xnfp->xnf_stat_gref_outstanding > xnfp->xnf_stat_gref_peak) xnfp->xnf_stat_gref_peak = xnfp->xnf_stat_gref_outstanding; } --- 364,374 ---- mutex_exit(&xnfp->xnf_gref_lock); if (gref == INVALID_GRANT_REF) { xnfp->xnf_stat_gref_failure++; } else { ! atomic_inc_64(&xnfp->xnf_stat_gref_outstanding); if (xnfp->xnf_stat_gref_outstanding > xnfp->xnf_stat_gref_peak) xnfp->xnf_stat_gref_peak = xnfp->xnf_stat_gref_outstanding; }
*** 385,395 **** mutex_enter(&xnfp->xnf_gref_lock); gnttab_release_grant_reference(&xnfp->xnf_gref_head, gref); mutex_exit(&xnfp->xnf_gref_lock); ! atomic_add_64(&xnfp->xnf_stat_gref_outstanding, -1); } /* * Acquire a transmit id. */ --- 385,395 ---- mutex_enter(&xnfp->xnf_gref_lock); gnttab_release_grant_reference(&xnfp->xnf_gref_head, gref); mutex_exit(&xnfp->xnf_gref_lock); ! atomic_dec_64(&xnfp->xnf_stat_gref_outstanding); } /* * Acquire a transmit id. */
*** 2350,2360 **** bdesc->buf_mfn = pfn_to_mfn(xnf_btop(bdesc->buf_phys)); bdesc->len = dma_cookie.dmac_size; bdesc->grant_ref = INVALID_GRANT_REF; bdesc->gen = xnfp->xnf_gen; ! atomic_add_64(&xnfp->xnf_stat_buf_allocated, 1); return (0); failure_2: ddi_dma_mem_free(&bdesc->acc_handle); --- 2350,2360 ---- bdesc->buf_mfn = pfn_to_mfn(xnf_btop(bdesc->buf_phys)); bdesc->len = dma_cookie.dmac_size; bdesc->grant_ref = INVALID_GRANT_REF; bdesc->gen = xnfp->xnf_gen; ! atomic_inc_64(&xnfp->xnf_stat_buf_allocated); return (0); failure_2: ddi_dma_mem_free(&bdesc->acc_handle);
*** 2376,2386 **** (void) ddi_dma_unbind_handle(bdesc->dma_handle); ddi_dma_mem_free(&bdesc->acc_handle); ddi_dma_free_handle(&bdesc->dma_handle); ! atomic_add_64(&xnfp->xnf_stat_buf_allocated, -1); } static xnf_buf_t * xnf_buf_get(xnf_t *xnfp, int flags, boolean_t readonly) { --- 2376,2386 ---- (void) ddi_dma_unbind_handle(bdesc->dma_handle); ddi_dma_mem_free(&bdesc->acc_handle); ddi_dma_free_handle(&bdesc->dma_handle); ! atomic_dec_64(&xnfp->xnf_stat_buf_allocated); } static xnf_buf_t * xnf_buf_get(xnf_t *xnfp, int flags, boolean_t readonly) {
*** 2410,2420 **** gnttab_grant_foreign_access_ref(bufp->grant_ref, xvdi_get_oeid(bufp->xnfp->xnf_devinfo), bufp->buf_mfn, readonly ? 1 : 0); ! atomic_add_64(&xnfp->xnf_stat_buf_outstanding, 1); return (bufp); } static void --- 2410,2420 ---- gnttab_grant_foreign_access_ref(bufp->grant_ref, xvdi_get_oeid(bufp->xnfp->xnf_devinfo), bufp->buf_mfn, readonly ? 1 : 0); ! atomic_inc_64(&xnfp->xnf_stat_buf_outstanding); return (bufp); } static void
*** 2427,2437 **** bufp->grant_ref = INVALID_GRANT_REF; } kmem_cache_free(xnfp->xnf_buf_cache, bufp); ! atomic_add_64(&xnfp->xnf_stat_buf_outstanding, -1); } /* * Refresh any cached data about a buffer after resume. */ --- 2427,2437 ---- bufp->grant_ref = INVALID_GRANT_REF; } kmem_cache_free(xnfp->xnf_buf_cache, bufp); ! atomic_dec_64(&xnfp->xnf_stat_buf_outstanding); } /* * Refresh any cached data about a buffer after resume. */