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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfeature.c
          +++ new/usr/src/uts/common/fs/zfs/zfeature.c
↓ open down ↓ 338 lines elided ↑ open up ↑
 339  339              DMU_POOL_FEATURE_DESCRIPTIONS, tx);
 340  340  }
 341  341  
 342  342  /*
 343  343   * Enable any required dependencies, then enable the requested feature.
 344  344   */
 345  345  void
 346  346  spa_feature_enable(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
 347  347  {
 348  348          ASSERT3U(spa_version(spa), >=, SPA_VERSION_FEATURES);
 349      -        VERIFY3U(0, ==, feature_do_action(spa->spa_meta_objset,
      349 +        VERIFY0(feature_do_action(spa->spa_meta_objset,
 350  350              spa->spa_feat_for_read_obj, spa->spa_feat_for_write_obj,
 351  351              spa->spa_feat_desc_obj, feature, FEATURE_ACTION_ENABLE, tx));
 352  352  }
 353  353  
 354  354  /*
 355  355   * If the specified feature has not yet been enabled, this function returns
 356  356   * ENOTSUP; otherwise, this function increments the feature's refcount (or
 357  357   * returns EOVERFLOW if the refcount cannot be incremented). This function must
 358  358   * be called from syncing context.
 359  359   */
 360  360  void
 361  361  spa_feature_incr(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
 362  362  {
 363  363          ASSERT3U(spa_version(spa), >=, SPA_VERSION_FEATURES);
 364      -        VERIFY3U(0, ==, feature_do_action(spa->spa_meta_objset,
      364 +        VERIFY0(feature_do_action(spa->spa_meta_objset,
 365  365              spa->spa_feat_for_read_obj, spa->spa_feat_for_write_obj,
 366  366              spa->spa_feat_desc_obj, feature, FEATURE_ACTION_INCR, tx));
 367  367  }
 368  368  
 369  369  /*
 370  370   * If the specified feature has not yet been enabled, this function returns
 371  371   * ENOTSUP; otherwise, this function decrements the feature's refcount (or
 372  372   * returns EOVERFLOW if the refcount is already 0). This function must
 373  373   * be called from syncing context.
 374  374   */
 375  375  void
 376  376  spa_feature_decr(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
 377  377  {
 378  378          ASSERT3U(spa_version(spa), >=, SPA_VERSION_FEATURES);
 379      -        VERIFY3U(0, ==, feature_do_action(spa->spa_meta_objset,
      379 +        VERIFY0(feature_do_action(spa->spa_meta_objset,
 380  380              spa->spa_feat_for_read_obj, spa->spa_feat_for_write_obj,
 381  381              spa->spa_feat_desc_obj, feature, FEATURE_ACTION_DECR, tx));
 382  382  }
 383  383  
 384  384  boolean_t
 385  385  spa_feature_is_enabled(spa_t *spa, zfeature_info_t *feature)
 386  386  {
 387  387          int err;
 388  388          uint64_t refcount;
 389  389  
↓ open down ↓ 25 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX