Skip to content

Commit

Permalink
Increase allowed 'special_small_blocks' maximum value
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue #9131
  • Loading branch information
behlendorf committed Nov 11, 2019
1 parent 035ebb3 commit 254d15a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 13 additions & 4 deletions lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,12 +1231,19 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
}

case ZFS_PROP_SPECIAL_SMALL_BLOCKS:
{
int maxbs = SPA_OLD_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 setable properties succeed.
* tests for settable properties succeed.
*/
if (zpool_prop_get_feature(zpool_hdl,
"feature@allocation_classes", state,
Expand All @@ -1249,15 +1256,17 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
}
if (intval != 0 &&
(intval < SPA_MINBLOCKSIZE ||
intval > SPA_OLD_MAXBLOCKSIZE || !ISP2(intval))) {
intval > maxbs || !ISP2(intval))) {
zfs_nicebytes(maxbs, buf, sizeof (buf));
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid '%s=%d' property: must be zero or "
"a power of 2 from 512B to 128K"), propname,
intval);
"a power of 2 from 512B to %s"), propname,
intval, buf);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
}
break;
}

case ZFS_PROP_MLSLABEL:
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
# DESCRIPTION:
# Setting the special_small_blocks property to invalid values fails.
# Powers of two from 512 to 1M are allowed.
#

verify_runnable "global"
Expand All @@ -34,7 +35,7 @@ log_must disk_setup
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1

for value in 256 1025 262144
for value in 256 1025 2097152
do
log_mustnot zfs set special_small_blocks=$value $TESTPOOL
done
Expand Down

0 comments on commit 254d15a

Please sign in to comment.