Print this page
5042 stop using deprecated atomic functions


2820 /*
2821  * Set the operations vector for a vnode.
2822  *
2823  * FEM ensures that the v_femhead pointer is filled in before the
2824  * v_op pointer is changed.  This means that if the v_femhead pointer
2825  * is NULL, and the v_op field hasn't changed since before which checked
2826  * the v_femhead pointer; then our update is ok - we are not racing with
2827  * FEM.
2828  */
2829 void
2830 vn_setops(vnode_t *vp, vnodeops_t *vnodeops)
2831 {
2832         vnodeops_t      *op;
2833 
2834         ASSERT(vp != NULL);
2835         ASSERT(vnodeops != NULL);
2836 
2837         op = vp->v_op;
2838         membar_consumer();
2839         /*
2840          * If vp->v_femhead == NULL, then we'll call casptr() to do the
2841          * compare-and-swap on vp->v_op.  If either fails, then FEM is
2842          * in effect on the vnode and we need to have FEM deal with it.
2843          */
2844         if (vp->v_femhead != NULL || casptr(&vp->v_op, op, vnodeops) != op) {

2845                 fem_setvnops(vp, vnodeops);
2846         }
2847 }
2848 
2849 /*
2850  * Retrieve the operations vector for a vnode
2851  * As with vn_setops(above); make sure we aren't racing with FEM.
2852  * FEM sets the v_op to a special, internal, vnodeops that wouldn't
2853  * make sense to the callers of this routine.
2854  */
2855 vnodeops_t *
2856 vn_getops(vnode_t *vp)
2857 {
2858         vnodeops_t      *op;
2859 
2860         ASSERT(vp != NULL);
2861 
2862         op = vp->v_op;
2863         membar_consumer();
2864         if (vp->v_femhead == NULL && op == vp->v_op) {




2820 /*
2821  * Set the operations vector for a vnode.
2822  *
2823  * FEM ensures that the v_femhead pointer is filled in before the
2824  * v_op pointer is changed.  This means that if the v_femhead pointer
2825  * is NULL, and the v_op field hasn't changed since before which checked
2826  * the v_femhead pointer; then our update is ok - we are not racing with
2827  * FEM.
2828  */
2829 void
2830 vn_setops(vnode_t *vp, vnodeops_t *vnodeops)
2831 {
2832         vnodeops_t      *op;
2833 
2834         ASSERT(vp != NULL);
2835         ASSERT(vnodeops != NULL);
2836 
2837         op = vp->v_op;
2838         membar_consumer();
2839         /*
2840          * If vp->v_femhead == NULL, then we'll call atomic_cas_ptr() to do
2841          * the compare-and-swap on vp->v_op.  If either fails, then FEM is
2842          * in effect on the vnode and we need to have FEM deal with it.
2843          */
2844         if (vp->v_femhead != NULL || atomic_cas_ptr(&vp->v_op, op, vnodeops) !=
2845             op) {
2846                 fem_setvnops(vp, vnodeops);
2847         }
2848 }
2849 
2850 /*
2851  * Retrieve the operations vector for a vnode
2852  * As with vn_setops(above); make sure we aren't racing with FEM.
2853  * FEM sets the v_op to a special, internal, vnodeops that wouldn't
2854  * make sense to the callers of this routine.
2855  */
2856 vnodeops_t *
2857 vn_getops(vnode_t *vp)
2858 {
2859         vnodeops_t      *op;
2860 
2861         ASSERT(vp != NULL);
2862 
2863         op = vp->v_op;
2864         membar_consumer();
2865         if (vp->v_femhead == NULL && op == vp->v_op) {