Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero


 882                 if (match_object && match_offset) {
 883                         DB_DNODE_EXIT(db);
 884                         return;
 885                 }
 886         }
 887         DB_DNODE_EXIT(db);
 888         panic("dirtying dbuf obj=%llx lvl=%u blkid=%llx but not tx_held\n",
 889             (u_longlong_t)db->db.db_object, db->db_level,
 890             (u_longlong_t)db->db_blkid);
 891 }
 892 #endif
 893 
 894 static int
 895 dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how)
 896 {
 897         dmu_tx_hold_t *txh;
 898         spa_t *spa = tx->tx_pool->dp_spa;
 899         uint64_t memory, asize, fsize, usize;
 900         uint64_t towrite, tofree, tooverwrite, tounref, tohold, fudge;
 901 
 902         ASSERT3U(tx->tx_txg, ==, 0);
 903 
 904         if (tx->tx_err)
 905                 return (tx->tx_err);
 906 
 907         if (spa_suspended(spa)) {
 908                 /*
 909                  * If the user has indicated a blocking failure mode
 910                  * then return ERESTART which will block in dmu_tx_wait().
 911                  * Otherwise, return EIO so that an error can get
 912                  * propagated back to the VOP calls.
 913                  *
 914                  * Note that we always honor the txg_how flag regardless
 915                  * of the failuremode setting.
 916                  */
 917                 if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE &&
 918                     txg_how != TXG_WAIT)
 919                         return (EIO);
 920 
 921                 return (ERESTART);
 922         }




 882                 if (match_object && match_offset) {
 883                         DB_DNODE_EXIT(db);
 884                         return;
 885                 }
 886         }
 887         DB_DNODE_EXIT(db);
 888         panic("dirtying dbuf obj=%llx lvl=%u blkid=%llx but not tx_held\n",
 889             (u_longlong_t)db->db.db_object, db->db_level,
 890             (u_longlong_t)db->db_blkid);
 891 }
 892 #endif
 893 
 894 static int
 895 dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how)
 896 {
 897         dmu_tx_hold_t *txh;
 898         spa_t *spa = tx->tx_pool->dp_spa;
 899         uint64_t memory, asize, fsize, usize;
 900         uint64_t towrite, tofree, tooverwrite, tounref, tohold, fudge;
 901 
 902         ASSERT0(tx->tx_txg);
 903 
 904         if (tx->tx_err)
 905                 return (tx->tx_err);
 906 
 907         if (spa_suspended(spa)) {
 908                 /*
 909                  * If the user has indicated a blocking failure mode
 910                  * then return ERESTART which will block in dmu_tx_wait().
 911                  * Otherwise, return EIO so that an error can get
 912                  * propagated back to the VOP calls.
 913                  *
 914                  * Note that we always honor the txg_how flag regardless
 915                  * of the failuremode setting.
 916                  */
 917                 if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE &&
 918                     txg_how != TXG_WAIT)
 919                         return (EIO);
 920 
 921                 return (ERESTART);
 922         }