mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Relax special_small_blocks restrictions
special_small_blocks is applied to blocks after compression, so it makes no sense to demand its values to be power of 2. At most they could be multiple of 512, but that would still buy us nothing, so lets allow them be any within SPA_MAXBLOCKSIZE. Also special_small_blocks does not really need to depend on the set recordsize, enabled pool features or presence of special vdev. At worst in any of those cases it will just do nothing, so we should not complicate users lives by artificial limitations. While there, polish comments for recordsize and volblocksize. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #17497
This commit is contained in:
@@ -1039,7 +1039,6 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
||||
nvlist_t *ret;
|
||||
int chosen_normal = -1;
|
||||
int chosen_utf = -1;
|
||||
int set_maxbs = 0;
|
||||
|
||||
if (nvlist_alloc(&ret, NV_UNIQUE_NAME, 0) != 0) {
|
||||
(void) no_memory(hdl);
|
||||
@@ -1258,46 +1257,20 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
/* save the ZFS_PROP_RECORDSIZE during create op */
|
||||
if (zpool_hdl == NULL && prop == ZFS_PROP_RECORDSIZE) {
|
||||
set_maxbs = intval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ZFS_PROP_SPECIAL_SMALL_BLOCKS:
|
||||
{
|
||||
int maxbs =
|
||||
set_maxbs == 0 ? SPA_OLD_MAXBLOCKSIZE : set_maxbs;
|
||||
int maxbs = SPA_MAXBLOCKSIZE;
|
||||
char buf[64];
|
||||
|
||||
if (zpool_hdl != NULL) {
|
||||
char state[64] = "";
|
||||
|
||||
maxbs = zpool_get_prop_int(zpool_hdl,
|
||||
ZPOOL_PROP_MAXBLOCKSIZE, NULL);
|
||||
|
||||
/*
|
||||
* Issue a warning but do not fail so that
|
||||
* tests for settable properties succeed.
|
||||
*/
|
||||
if (zpool_prop_get_feature(zpool_hdl,
|
||||
"feature@allocation_classes", state,
|
||||
sizeof (state)) != 0 ||
|
||||
strcmp(state, ZFS_FEATURE_ACTIVE) != 0) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"%s: property requires a special "
|
||||
"device in the pool\n"), propname);
|
||||
}
|
||||
}
|
||||
if (intval != 0 &&
|
||||
(intval < SPA_MINBLOCKSIZE ||
|
||||
intval > maxbs || !ISP2(intval))) {
|
||||
if (intval > SPA_MAXBLOCKSIZE) {
|
||||
zfs_nicebytes(maxbs, buf, sizeof (buf));
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"invalid '%s=%llu' property: must be zero "
|
||||
"or a power of 2 from 512B to %s"),
|
||||
propname, (unsigned long long)intval, buf);
|
||||
"invalid '%s' property: must be between "
|
||||
"zero and %s"),
|
||||
propname, buf);
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -1421,30 +1421,6 @@ zpool_get_state(zpool_handle_t *zhp)
|
||||
return (zhp->zpool_state);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if vdev list contains a special vdev
|
||||
*/
|
||||
static boolean_t
|
||||
zpool_has_special_vdev(nvlist_t *nvroot)
|
||||
{
|
||||
nvlist_t **child;
|
||||
uint_t children;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &child,
|
||||
&children) == 0) {
|
||||
for (uint_t c = 0; c < children; c++) {
|
||||
const char *bias;
|
||||
|
||||
if (nvlist_lookup_string(child[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias) == 0 &&
|
||||
strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0) {
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if vdev list contains a dRAID vdev
|
||||
*/
|
||||
@@ -1548,16 +1524,6 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
|
||||
goto create_failed;
|
||||
}
|
||||
|
||||
if (nvlist_exists(zc_fsprops,
|
||||
zfs_prop_to_name(ZFS_PROP_SPECIAL_SMALL_BLOCKS)) &&
|
||||
!zpool_has_special_vdev(nvroot)) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"%s property requires a special vdev"),
|
||||
zfs_prop_to_name(ZFS_PROP_SPECIAL_SMALL_BLOCKS));
|
||||
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto create_failed;
|
||||
}
|
||||
|
||||
if (!zc_props &&
|
||||
(nvlist_alloc(&zc_props, NV_UNIQUE_NAME, 0) != 0)) {
|
||||
goto create_failed;
|
||||
|
||||
Reference in New Issue
Block a user