Print this page
Integrated Edon-R hash function.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ioctl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ioctl.c
↓ open down ↓ 2383 lines elided ↑ open up ↑
2384 2384                  if (err == 0 && intval >= ZPL_VERSION_USERSPACE) {
2385 2385                          zfs_cmd_t *zc;
2386 2386  
2387 2387                          zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
2388 2388                          (void) strcpy(zc->zc_name, dsname);
2389 2389                          (void) zfs_ioc_userspace_upgrade(zc);
2390 2390                          kmem_free(zc, sizeof (zfs_cmd_t));
2391 2391                  }
2392 2392                  break;
2393 2393          }
     2394 +        case ZFS_PROP_CHECKSUM:
     2395 +        {
     2396 +                if (intval == ZIO_CHECKSUM_EDONR512_256) {
     2397 +                        zfeature_info_t *feature =
     2398 +                            &spa_feature_table[SPA_FEATURE_EDONR_CKSUM];
     2399 +                        spa_t *spa;
     2400 +                        dsl_pool_t *dp;
     2401 +
     2402 +                        if ((err = spa_open(dsname, &spa, FTAG)) != 0)
     2403 +                                return (err);
     2404 +
     2405 +                        dp = spa->spa_dsl_pool;
     2406 +
     2407 +                        /*
     2408 +                         * Setting the Edon-R checksum algorithm activates
     2409 +                         * the feature.
     2410 +                         */
     2411 +                        if (!spa_feature_is_active(spa, feature)) {
     2412 +                                if ((err = zfs_prop_activate_feature(dp,
     2413 +                                    feature)) != 0) {
     2414 +                                        spa_close(spa, FTAG);
     2415 +                                        return (err);
     2416 +                                }
     2417 +                        }
     2418 +
     2419 +                        spa_close(spa, FTAG);
     2420 +                }
     2421 +                /*
     2422 +                 * We still want the default set action to be performed in the
     2423 +                 * caller, we only performed zfeature settings here.
     2424 +                 */
     2425 +                err = -1;
     2426 +                break;
     2427 +        }
2394 2428          case ZFS_PROP_COMPRESSION:
2395 2429          {
2396 2430                  if (intval == ZIO_COMPRESS_LZ4) {
2397 2431                          zfeature_info_t *feature =
2398 2432                              &spa_feature_table[SPA_FEATURE_LZ4_COMPRESS];
2399 2433                          spa_t *spa;
2400 2434                          dsl_pool_t *dp;
2401 2435  
2402 2436                          if ((err = spa_open(dsname, &spa, FTAG)) != 0)
2403 2437                                  return (err);
↓ open down ↓ 1238 lines elided ↑ open up ↑
3642 3676                  nvlist_t *attrs;
3643 3677                  VERIFY(nvpair_value_nvlist(pair, &attrs) == 0);
3644 3678                  VERIFY(nvlist_lookup_nvpair(attrs, ZPROP_VALUE,
3645 3679                      &pair) == 0);
3646 3680          }
3647 3681  
3648 3682          /*
3649 3683           * Check that this value is valid for this pool version
3650 3684           */
3651 3685          switch (prop) {
     3686 +        case ZFS_PROP_CHECKSUM:
     3687 +                if (nvpair_type(pair) == DATA_TYPE_UINT64 &&
     3688 +                    nvpair_value_uint64(pair, &intval) == 0) {
     3689 +                        if (intval == ZIO_CHECKSUM_EDONR512_256) {
     3690 +                                zfeature_info_t *feature =
     3691 +                                    &spa_feature_table[SPA_FEATURE_EDONR_CKSUM];
     3692 +                                spa_t *spa;
     3693 +
     3694 +                                if ((err = spa_open(dsname, &spa, FTAG)) != 0)
     3695 +                                        return (err);
     3696 +
     3697 +                                if (!spa_feature_is_enabled(spa, feature)) {
     3698 +                                        spa_close(spa, FTAG);
     3699 +                                        return (ENOTSUP);
     3700 +                                }
     3701 +                                spa_close(spa, FTAG);
     3702 +                        }
     3703 +                }
     3704 +                break;
3652 3705          case ZFS_PROP_COMPRESSION:
3653 3706                  /*
3654 3707                   * If the user specified gzip compression, make sure
3655 3708                   * the SPA supports it. We ignore any errors here since
3656 3709                   * we'll catch them later.
3657 3710                   */
3658 3711                  if (nvpair_type(pair) == DATA_TYPE_UINT64 &&
3659 3712                      nvpair_value_uint64(pair, &intval) == 0) {
3660 3713                          if (intval >= ZIO_COMPRESS_GZIP_1 &&
3661 3714                              intval <= ZIO_COMPRESS_GZIP_9 &&
↓ open down ↓ 2363 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX