aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/spa_misc.c
diff options
context:
space:
mode:
authorRob Norris <[email protected]>2023-06-27 11:03:29 +1000
committerBrian Behlendorf <[email protected]>2024-07-29 17:05:08 -0700
commite26b3771ee43256a0347b7ec2503abbed7b5ecd5 (patch)
treeeb00d0570f2ada31f123ebcdf0a32648e7124172 /module/zfs/spa_misc.c
parented87d456e4ebcd031d43c29b93d0a664581a51f7 (diff)
spa_preferred_class: pass the entire zio
Rather than picking out specific values out of the properties, just pass the entire zio in, to make it easier in the future to use more of that info to decide on the storage class. I would have rathered just pass io_prop in, but having spa.h include zio.h gets a bit tricky. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: Klara, Inc. Sponsored-by: iXsystems, Inc. Closes #15894
Diffstat (limited to 'module/zfs/spa_misc.c')
-rw-r--r--module/zfs/spa_misc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 439e56f0d..c9ee36c0f 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -2007,9 +2007,11 @@ spa_special_has_ddt(spa_t *spa)
* Locate an appropriate allocation class
*/
metaslab_class_t *
-spa_preferred_class(spa_t *spa, uint64_t size, dmu_object_type_t objtype,
- uint_t level, uint_t special_smallblk)
+spa_preferred_class(spa_t *spa, const zio_t *zio)
{
+ const zio_prop_t *zp = &zio->io_prop;
+ dmu_object_type_t objtype = zp->zp_type;
+
/*
* ZIL allocations determine their class in zio_alloc_zil().
*/
@@ -2027,14 +2029,15 @@ spa_preferred_class(spa_t *spa, uint64_t size, dmu_object_type_t objtype,
}
/* Indirect blocks for user data can land in special if allowed */
- if (level > 0 && (DMU_OT_IS_FILE(objtype) || objtype == DMU_OT_ZVOL)) {
+ if (zp->zp_level > 0 &&
+ (DMU_OT_IS_FILE(objtype) || objtype == DMU_OT_ZVOL)) {
if (has_special_class && zfs_user_indirect_is_special)
return (spa_special_class(spa));
else
return (spa_normal_class(spa));
}
- if (DMU_OT_IS_METADATA(objtype) || level > 0) {
+ if (DMU_OT_IS_METADATA(objtype) || zp->zp_level > 0) {
if (has_special_class)
return (spa_special_class(spa));
else
@@ -2047,7 +2050,7 @@ spa_preferred_class(spa_t *spa, uint64_t size, dmu_object_type_t objtype,
* zfs_special_class_metadata_reserve_pct exclusively for metadata.
*/
if (DMU_OT_IS_FILE(objtype) &&
- has_special_class && size <= special_smallblk) {
+ 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);
uint64_t space = metaslab_class_get_space(special);