Skip to content

Commit 624222a

Browse files
authored
Increase allowed 'special_small_blocks' maximum value
There may be circumstances where it's desirable that all blocks in a specified dataset be stored on the special device. Relax the artificial 128K limit and allow the special_small_blocks property to be set up to 1M. When blocks >1MB have been enabled via the zfs_max_recordsize module option, this limit is increased accordingly. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Kjeld Schouten <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #9131 Closes #9355
1 parent b367334 commit 624222a

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

lib/libzfs/libzfs_dataset.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,12 +1229,19 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
12291229
}
12301230

12311231
case ZFS_PROP_SPECIAL_SMALL_BLOCKS:
1232+
{
1233+
int maxbs = SPA_OLD_MAXBLOCKSIZE;
1234+
char buf[64];
1235+
12321236
if (zpool_hdl != NULL) {
12331237
char state[64] = "";
12341238

1239+
maxbs = zpool_get_prop_int(zpool_hdl,
1240+
ZPOOL_PROP_MAXBLOCKSIZE, NULL);
1241+
12351242
/*
12361243
* Issue a warning but do not fail so that
1237-
* tests for setable properties succeed.
1244+
* tests for settable properties succeed.
12381245
*/
12391246
if (zpool_prop_get_feature(zpool_hdl,
12401247
"feature@allocation_classes", state,
@@ -1247,15 +1254,17 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
12471254
}
12481255
if (intval != 0 &&
12491256
(intval < SPA_MINBLOCKSIZE ||
1250-
intval > SPA_OLD_MAXBLOCKSIZE || !ISP2(intval))) {
1257+
intval > maxbs || !ISP2(intval))) {
1258+
zfs_nicebytes(maxbs, buf, sizeof (buf));
12511259
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
12521260
"invalid '%s=%d' property: must be zero or "
1253-
"a power of 2 from 512B to 128K"), propname,
1254-
intval);
1261+
"a power of 2 from 512B to %s"), propname,
1262+
intval, buf);
12551263
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
12561264
goto error;
12571265
}
12581266
break;
1267+
}
12591268

12601269
case ZFS_PROP_MLSLABEL:
12611270
{

man/man8/zfsprops.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ This value represents the threshold block size for including small file
10551055
blocks into the special allocation class. Blocks smaller than or equal to this
10561056
value will be assigned to the special allocation class while greater blocks
10571057
will be assigned to the regular class. Valid values are zero or a power of two
1058-
from 512B up to 128K. The default size is 0 which means no small file blocks
1058+
from 512B up to 1M. The default size is 0 which means no small file blocks
10591059
will be allocated in the special class.
10601060
.Pp
10611061
Before setting this property, a special class vdev must be added to the

module/zcommon/zfs_prop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ zfs_prop_init(void)
544544
ZFS_TYPE_FILESYSTEM, "512 to 1M, power of 2", "RECSIZE");
545545
zprop_register_number(ZFS_PROP_SPECIAL_SMALL_BLOCKS,
546546
"special_small_blocks", 0, PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
547-
"zero or 512 to 128K, power of 2", "SPECIAL_SMALL_BLOCKS");
547+
"zero or 512 to 1M, power of 2", "SPECIAL_SMALL_BLOCKS");
548548

549549
/* hidden properties */
550550
zprop_register_hidden(ZFS_PROP_NUMCLONES, "numclones", PROP_TYPE_NUMBER,

tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#
2222
# DESCRIPTION:
2323
# Setting the special_small_blocks property to invalid values fails.
24+
# Powers of two from 512 to 1M are allowed.
2425
#
2526

2627
verify_runnable "global"
@@ -34,7 +35,7 @@ log_must disk_setup
3435
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
3536
$CLASS_DISK0 $CLASS_DISK1
3637

37-
for value in 256 1025 262144
38+
for value in 256 1025 2097152
3839
do
3940
log_mustnot zfs set special_small_blocks=$value $TESTPOOL
4041
done

0 commit comments

Comments
 (0)