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


 146 
 147 void
 148 dsl_sync_task_group_destroy(dsl_sync_task_group_t *dstg)
 149 {
 150         dsl_sync_task_t *dst;
 151 
 152         while (dst = list_head(&dstg->dstg_tasks)) {
 153                 list_remove(&dstg->dstg_tasks, dst);
 154                 kmem_free(dst, sizeof (dsl_sync_task_t));
 155         }
 156         kmem_free(dstg, sizeof (dsl_sync_task_group_t));
 157 }
 158 
 159 void
 160 dsl_sync_task_group_sync(dsl_sync_task_group_t *dstg, dmu_tx_t *tx)
 161 {
 162         dsl_sync_task_t *dst;
 163         dsl_pool_t *dp = dstg->dstg_pool;
 164         uint64_t quota, used;
 165 
 166         ASSERT3U(dstg->dstg_err, ==, 0);
 167 
 168         /*
 169          * Check for sufficient space.  We just check against what's
 170          * on-disk; we don't want any in-flight accounting to get in our
 171          * way, because open context may have already used up various
 172          * in-core limits (arc_tempreserve, dsl_pool_tempreserve).
 173          */
 174         quota = dsl_pool_adjustedsize(dp, B_FALSE) -
 175             metaslab_class_get_deferred(spa_normal_class(dp->dp_spa));
 176         used = dp->dp_root_dir->dd_phys->dd_used_bytes;
 177         /* MOS space is triple-dittoed, so we multiply by 3. */
 178         if (dstg->dstg_space > 0 && used + dstg->dstg_space * 3 > quota) {
 179                 dstg->dstg_err = ENOSPC;
 180                 return;
 181         }
 182 
 183         /*
 184          * Check for errors by calling checkfuncs.
 185          */
 186         rw_enter(&dp->dp_config_rwlock, RW_WRITER);




 146 
 147 void
 148 dsl_sync_task_group_destroy(dsl_sync_task_group_t *dstg)
 149 {
 150         dsl_sync_task_t *dst;
 151 
 152         while (dst = list_head(&dstg->dstg_tasks)) {
 153                 list_remove(&dstg->dstg_tasks, dst);
 154                 kmem_free(dst, sizeof (dsl_sync_task_t));
 155         }
 156         kmem_free(dstg, sizeof (dsl_sync_task_group_t));
 157 }
 158 
 159 void
 160 dsl_sync_task_group_sync(dsl_sync_task_group_t *dstg, dmu_tx_t *tx)
 161 {
 162         dsl_sync_task_t *dst;
 163         dsl_pool_t *dp = dstg->dstg_pool;
 164         uint64_t quota, used;
 165 
 166         ASSERT0(dstg->dstg_err);
 167 
 168         /*
 169          * Check for sufficient space.  We just check against what's
 170          * on-disk; we don't want any in-flight accounting to get in our
 171          * way, because open context may have already used up various
 172          * in-core limits (arc_tempreserve, dsl_pool_tempreserve).
 173          */
 174         quota = dsl_pool_adjustedsize(dp, B_FALSE) -
 175             metaslab_class_get_deferred(spa_normal_class(dp->dp_spa));
 176         used = dp->dp_root_dir->dd_phys->dd_used_bytes;
 177         /* MOS space is triple-dittoed, so we multiply by 3. */
 178         if (dstg->dstg_space > 0 && used + dstg->dstg_space * 3 > quota) {
 179                 dstg->dstg_err = ENOSPC;
 180                 return;
 181         }
 182 
 183         /*
 184          * Check for errors by calling checkfuncs.
 185          */
 186         rw_enter(&dp->dp_config_rwlock, RW_WRITER);