Skip to content

Commit 1f97269

Browse files
amotinandrewc12
authored andcommitted
Improve mg_aliquot mah
When calculating mg_aliquot alike to openzfs#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 <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored-By: iXsystems, Inc. Closes openzfs#13388
1 parent b87d113 commit 1f97269

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

man/man4/zfs.4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ For L2ARC devices less than 1GB, the amount of data
218218
evicts is significant compared to the amount of restored L2ARC data.
219219
In this case, do not write log blocks in L2ARC in order not to waste space.
220220
.
221-
.It Sy metaslab_aliquot Ns = Ns Sy 524288 Ns B Po 512kB Pc Pq ulong
221+
.It Sy metaslab_aliquot Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
222222
Metaslab granularity, in bytes.
223223
This is roughly similar to what would be referred to as the "stripe size"
224224
in traditional RAID arrays.
225-
In normal operation, ZFS will try to write this amount of data
226-
to a top-level vdev before moving on to the next one.
225+
In normal operation, ZFS will try to write this amount of data to each disk
226+
before moving on to the next top-level vdev.
227227
.
228228
.It Sy metaslab_bias_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
229229
Enable metaslab group biasing based on their vdevs' over- or under-utilization

module/zfs/metaslab.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
/*
4949
* Metaslab granularity, in bytes. This is roughly similar to what would be
5050
* referred to as the "stripe size" in traditional RAID arrays. In normal
51-
* operation, we will try to write this amount of data to a top-level vdev
52-
* before moving on to the next one.
51+
* operation, we will try to write this amount of data to each disk before
52+
* moving on to the next top-level vdev.
5353
*/
54-
static ZFS_MODULE_ULONG metaslab_aliquot = 512 << 10;
54+
static unsigned long metaslab_aliquot = 1024 * 1024;
5555

5656
/*
5757
* For testing, make some blocks above a certain size be gang blocks.
@@ -900,7 +900,8 @@ metaslab_group_activate(metaslab_group_t *mg)
900900
if (++mg->mg_activation_count <= 0)
901901
return;
902902

903-
mg->mg_aliquot = metaslab_aliquot * MAX(1, mg->mg_vd->vdev_children);
903+
mg->mg_aliquot = metaslab_aliquot * MAX(1,
904+
vdev_get_ndisks(mg->mg_vd) - vdev_get_nparity(mg->mg_vd));
904905
metaslab_group_alloc_update(mg);
905906

906907
if ((mgprev = mc->mc_allocator[0].mca_rotor) == NULL) {

0 commit comments

Comments
 (0)