Allow opt-in of zvol blocks in special class

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Signed-off-by: Don Brady <dev.fs.zfs@gmail.com>
Closes #14876
This commit is contained in:
Don Brady
2025-05-24 14:44:26 -06:00
committed by GitHub
parent 9d76950d67
commit b048bfa9c1
8 changed files with 75 additions and 10 deletions
+2 -1
View File
@@ -737,7 +737,8 @@ zfs_prop_init(void)
ZFS_TYPE_FILESYSTEM, "512 to 1M, power of 2", "RECSIZE", B_FALSE,
sfeatures);
zprop_register_number(ZFS_PROP_SPECIAL_SMALL_BLOCKS,
"special_small_blocks", 0, PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
"special_small_blocks", 0, PROP_INHERIT,
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"zero or 512 to 1M, power of 2", "SPECIAL_SMALL_BLOCKS", B_FALSE,
sfeatures);
+2 -1
View File
@@ -2489,7 +2489,8 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
memset(zp->zp_salt, 0, ZIO_DATA_SALT_LEN);
memset(zp->zp_iv, 0, ZIO_DATA_IV_LEN);
memset(zp->zp_mac, 0, ZIO_DATA_MAC_LEN);
zp->zp_zpl_smallblk = DMU_OT_IS_FILE(zp->zp_type) ?
zp->zp_zpl_smallblk = (DMU_OT_IS_FILE(zp->zp_type) ||
zp->zp_type == DMU_OT_ZVOL) ?
os->os_zpl_special_smallblock : 0;
zp->zp_storage_type = dn ? dn->dn_storage_type : DMU_OT_NONE;
+3 -3
View File
@@ -2064,11 +2064,11 @@ spa_preferred_class(spa_t *spa, const zio_t *zio)
}
/*
* Allow small file blocks in special class in some cases (like
* for the dRAID vdev feature). But always leave a reserve of
* Allow small file or zvol blocks in special class if opted in by
* the special_smallblk property. However, always leave a reserve of
* zfs_special_class_metadata_reserve_pct exclusively for metadata.
*/
if (DMU_OT_IS_FILE(objtype) &&
if ((DMU_OT_IS_FILE(objtype) || objtype == DMU_OT_ZVOL) &&
has_special_class && zio->io_size <= zp->zp_zpl_smallblk) {
metaslab_class_t *special = spa_special_class(spa);
uint64_t alloc = metaslab_class_get_alloc(special);