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


 903          *      When a nologging mount has completed there may still be
 904          *      work for reclaim to do so just suspend this thread until
 905          *      it's [deadlock-] safe for it to continue.  The delete
 906          *      thread won't be needed as ufs_iinactive() calls
 907          *      ufs_delete() when logging is disabled.
 908          * Freeze and drain reader ops.
 909          *      Commit any outstanding reader transactions (ufs_flush).
 910          *      Set the ``unmounted'' bit in the ufstrans struct.
 911          *      If debug, remove metadata from matamap.
 912          *      Disable matamap processing.
 913          *      NULL the trans ops table.
 914          *      Free all of the incore structs related to logging.
 915          * Allow reader ops.
 916          */
 917         ufs_thread_suspend(&ufsvfsp->vfs_reclaim);
 918         ufs_thread_exit(&ufsvfsp->vfs_delete);
 919 
 920         vfs_lock_wait(ufsvfsp->vfs_vfs);
 921         ulp = &ufsvfsp->vfs_ulockfs;
 922         mutex_enter(&ulp->ul_lock);
 923         atomic_add_long(&ufs_quiesce_pend, 1);
 924         (void) ufs_quiesce(ulp);
 925 
 926         (void) ufs_flush(ufsvfsp->vfs_vfs);
 927 
 928         TRANS_MATA_UMOUNT(ufsvfsp);
 929         ufsvfsp->vfs_domatamap = 0;
 930 
 931         /*
 932          * Free all of the incore structs
 933          * Aquire the ufs_scan_lock before de-linking the mtm data
 934          * structure so that we keep ufs_sync() and ufs_update() away
 935          * when they execute the ufs_scan_inodes() run while we're in
 936          * progress of enabling/disabling logging.
 937          */
 938         mutex_enter(&ufs_scan_lock);
 939         (void) lufs_unsnarf(ufsvfsp);
 940         mutex_exit(&ufs_scan_lock);
 941 
 942         atomic_add_long(&ufs_quiesce_pend, -1);
 943         mutex_exit(&ulp->ul_lock);
 944         vfs_setmntopt(ufsvfsp->vfs_vfs, MNTOPT_NOLOGGING, NULL, 0);
 945         vfs_unlock(ufsvfsp->vfs_vfs);
 946 
 947         fs->fs_rolled = FS_ALL_ROLLED;
 948         ufsvfsp->vfs_nolog_si = 0;
 949 
 950         /*
 951          * Free the log space and mark the superblock as FSACTIVE
 952          */
 953         (void) lufs_free(ufsvfsp);
 954 
 955         /*
 956          * Allow the reclaim thread to continue.
 957          */
 958         ufs_thread_continue(&ufsvfsp->vfs_reclaim);
 959 
 960         /*
 961          * Unlock the file system
 962          */




 903          *      When a nologging mount has completed there may still be
 904          *      work for reclaim to do so just suspend this thread until
 905          *      it's [deadlock-] safe for it to continue.  The delete
 906          *      thread won't be needed as ufs_iinactive() calls
 907          *      ufs_delete() when logging is disabled.
 908          * Freeze and drain reader ops.
 909          *      Commit any outstanding reader transactions (ufs_flush).
 910          *      Set the ``unmounted'' bit in the ufstrans struct.
 911          *      If debug, remove metadata from matamap.
 912          *      Disable matamap processing.
 913          *      NULL the trans ops table.
 914          *      Free all of the incore structs related to logging.
 915          * Allow reader ops.
 916          */
 917         ufs_thread_suspend(&ufsvfsp->vfs_reclaim);
 918         ufs_thread_exit(&ufsvfsp->vfs_delete);
 919 
 920         vfs_lock_wait(ufsvfsp->vfs_vfs);
 921         ulp = &ufsvfsp->vfs_ulockfs;
 922         mutex_enter(&ulp->ul_lock);
 923         atomic_inc_ulong(&ufs_quiesce_pend);
 924         (void) ufs_quiesce(ulp);
 925 
 926         (void) ufs_flush(ufsvfsp->vfs_vfs);
 927 
 928         TRANS_MATA_UMOUNT(ufsvfsp);
 929         ufsvfsp->vfs_domatamap = 0;
 930 
 931         /*
 932          * Free all of the incore structs
 933          * Aquire the ufs_scan_lock before de-linking the mtm data
 934          * structure so that we keep ufs_sync() and ufs_update() away
 935          * when they execute the ufs_scan_inodes() run while we're in
 936          * progress of enabling/disabling logging.
 937          */
 938         mutex_enter(&ufs_scan_lock);
 939         (void) lufs_unsnarf(ufsvfsp);
 940         mutex_exit(&ufs_scan_lock);
 941 
 942         atomic_dec_ulong(&ufs_quiesce_pend);
 943         mutex_exit(&ulp->ul_lock);
 944         vfs_setmntopt(ufsvfsp->vfs_vfs, MNTOPT_NOLOGGING, NULL, 0);
 945         vfs_unlock(ufsvfsp->vfs_vfs);
 946 
 947         fs->fs_rolled = FS_ALL_ROLLED;
 948         ufsvfsp->vfs_nolog_si = 0;
 949 
 950         /*
 951          * Free the log space and mark the superblock as FSACTIVE
 952          */
 953         (void) lufs_free(ufsvfsp);
 954 
 955         /*
 956          * Allow the reclaim thread to continue.
 957          */
 958         ufs_thread_continue(&ufsvfsp->vfs_reclaim);
 959 
 960         /*
 961          * Unlock the file system
 962          */