Print this page
Integrated Edon-R hash function.

*** 2389,2398 **** --- 2389,2432 ---- (void) zfs_ioc_userspace_upgrade(zc); kmem_free(zc, sizeof (zfs_cmd_t)); } break; } + case ZFS_PROP_CHECKSUM: + { + if (intval == ZIO_CHECKSUM_EDONR512_256) { + zfeature_info_t *feature = + &spa_feature_table[SPA_FEATURE_EDONR_CKSUM]; + spa_t *spa; + dsl_pool_t *dp; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + dp = spa->spa_dsl_pool; + + /* + * Setting the Edon-R checksum algorithm activates + * the feature. + */ + if (!spa_feature_is_active(spa, feature)) { + if ((err = zfs_prop_activate_feature(dp, + feature)) != 0) { + spa_close(spa, FTAG); + return (err); + } + } + + spa_close(spa, FTAG); + } + /* + * We still want the default set action to be performed in the + * caller, we only performed zfeature settings here. + */ + err = -1; + break; + } case ZFS_PROP_COMPRESSION: { if (intval == ZIO_COMPRESS_LZ4) { zfeature_info_t *feature = &spa_feature_table[SPA_FEATURE_LZ4_COMPRESS];
*** 3647,3656 **** --- 3681,3709 ---- /* * Check that this value is valid for this pool version */ switch (prop) { + case ZFS_PROP_CHECKSUM: + if (nvpair_type(pair) == DATA_TYPE_UINT64 && + nvpair_value_uint64(pair, &intval) == 0) { + if (intval == ZIO_CHECKSUM_EDONR512_256) { + zfeature_info_t *feature = + &spa_feature_table[SPA_FEATURE_EDONR_CKSUM]; + spa_t *spa; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + if (!spa_feature_is_enabled(spa, feature)) { + spa_close(spa, FTAG); + return (ENOTSUP); + } + spa_close(spa, FTAG); + } + } + break; case ZFS_PROP_COMPRESSION: /* * If the user specified gzip compression, make sure * the SPA supports it. We ignore any errors here since * we'll catch them later.