Improve mg_aliquot math

When calculating mg_aliquot alike to #12046 use number of unique data
disks in the vdev, not the total number of children vdev.  Increase
default value of the tunable from 512KB to 1MB to compensate.

Before this change each disk in striped pool was getting 512KB of
sequential data, in 2-wide mirror -- 1MB, in 3-wide RAIDZ1 -- 768KB.
After this change in all the cases each disk should get 1MB.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13388
This commit is contained in:
Alexander Motin 2022-05-04 14:33:42 -04:00 committed by Brian Behlendorf
parent dd9c110ab5
commit 6e1e90d64c
2 changed files with 8 additions and 7 deletions

View File

@ -213,12 +213,12 @@ For L2ARC devices less than 1GB, the amount of data
evicts is significant compared to the amount of restored L2ARC data. evicts is significant compared to the amount of restored L2ARC data.
In this case, do not write log blocks in L2ARC in order not to waste space. In this case, do not write log blocks in L2ARC in order not to waste space.
. .
.It Sy metaslab_aliquot Ns = Ns Sy 524288 Ns B Po 512kB Pc Pq ulong .It Sy metaslab_aliquot Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
Metaslab granularity, in bytes. Metaslab granularity, in bytes.
This is roughly similar to what would be referred to as the "stripe size" This is roughly similar to what would be referred to as the "stripe size"
in traditional RAID arrays. in traditional RAID arrays.
In normal operation, ZFS will try to write this amount of data In normal operation, ZFS will try to write this amount of data to each disk
to a top-level vdev before moving on to the next one. before moving on to the next top-level vdev.
. .
.It Sy metaslab_bias_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int .It Sy metaslab_bias_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
Enable metaslab group biasing based on their vdevs' over- or under-utilization Enable metaslab group biasing based on their vdevs' over- or under-utilization

View File

@ -48,10 +48,10 @@
/* /*
* Metaslab granularity, in bytes. This is roughly similar to what would be * Metaslab granularity, in bytes. This is roughly similar to what would be
* referred to as the "stripe size" in traditional RAID arrays. In normal * referred to as the "stripe size" in traditional RAID arrays. In normal
* operation, we will try to write this amount of data to a top-level vdev * operation, we will try to write this amount of data to each disk before
* before moving on to the next one. * moving on to the next top-level vdev.
*/ */
unsigned long metaslab_aliquot = 512 << 10; static unsigned long metaslab_aliquot = 1024 * 1024;
/* /*
* For testing, make some blocks above a certain size be gang blocks. * For testing, make some blocks above a certain size be gang blocks.
@ -899,7 +899,8 @@ metaslab_group_activate(metaslab_group_t *mg)
if (++mg->mg_activation_count <= 0) if (++mg->mg_activation_count <= 0)
return; return;
mg->mg_aliquot = metaslab_aliquot * MAX(1, mg->mg_vd->vdev_children); mg->mg_aliquot = metaslab_aliquot * MAX(1,
vdev_get_ndisks(mg->mg_vd) - vdev_get_nparity(mg->mg_vd));
metaslab_group_alloc_update(mg); metaslab_group_alloc_update(mg);
if ((mgprev = mc->mc_allocator[0].mca_rotor) == NULL) { if ((mgprev = mc->mc_allocator[0].mca_rotor) == NULL) {