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:
Alexander Motin
2025-07-02 14:11:37 -04:00
committed by GitHub
parent 17ee0fd4fa
commit 4e92aee233
13 changed files with 31 additions and 193 deletions
-2
View File
@@ -429,8 +429,6 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/alloc_class/alloc_class_011_neg.ksh \
functional/alloc_class/alloc_class_012_pos.ksh \
functional/alloc_class/alloc_class_013_pos.ksh \
functional/alloc_class/alloc_class_014_neg.ksh \
functional/alloc_class/alloc_class_015_pos.ksh \
functional/alloc_class/alloc_class_016_pos.ksh \
functional/alloc_class/cleanup.ksh \
functional/alloc_class/setup.ksh \
@@ -36,7 +36,7 @@ log_must disk_setup
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
for value in 0 512 1024 2048 4096 8192 16384 32768 65536 131072
for value in 0 200 512 1300 4096 12345 131072 1572864 16777216
do
log_must zfs set special_small_blocks=$value $TESTPOOL
ACTUAL=$(zfs get -p special_small_blocks $TESTPOOL | \
@@ -22,7 +22,7 @@
#
# DESCRIPTION:
# Setting the special_small_blocks property to invalid values fails.
# Powers of two from 512 to 1M are allowed.
# Only values between 0 and 16M including are allowed.
#
verify_runnable "global"
@@ -36,7 +36,7 @@ log_must disk_setup
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
for value in 256 1025 33554432
for value in 16777217 33554432 4294967296
do
log_mustnot zfs set special_small_blocks=$value $TESTPOOL
done
@@ -1,39 +0,0 @@
#!/bin/ksh -p
# SPDX-License-Identifier: CDDL-1.0
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
#
# DESCRIPTION:
# Setting the special_small_blocks property greater than recordsize fails.
#
verify_runnable "global"
claim="Setting the special_small_blocks property greater than recordsize fails"
log_assert $claim
log_onexit cleanup
log_must disk_setup
for size in 512 4096 32768 131072 524288 1048576
do
let bigger=$size*2
log_mustnot zpool create -O recordsize=$size \
-O special_small_blocks=$bigger \
$TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
done
log_pass $claim
@@ -1,46 +0,0 @@
#!/bin/ksh -p
# SPDX-License-Identifier: CDDL-1.0
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
#
# DESCRIPTION:
# Can set special_small_blocks property less than or equal to recordsize.
#
verify_runnable "global"
claim="Can set special_small_blocks property less than or equal to recordsize"
log_assert $claim
log_onexit cleanup
log_must disk_setup
for size in 8192 32768 131072 524288 1048576
do
let smaller=$size/2
log_must zpool create -O recordsize=$size \
-O special_small_blocks=$smaller \
$TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
log_must zpool destroy -f "$TESTPOOL"
log_must zpool create -O recordsize=$size \
-O special_small_blocks=$size \
$TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
log_must zpool destroy -f "$TESTPOOL"
done
log_pass $claim