Skip to content

Commit 271e900

Browse files
amotinsnajpa
authored andcommitted
Improve mg_aliquot math
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 fea3de1 commit 271e900

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
@@ -213,12 +213,12 @@ For L2ARC devices less than 1GB, the amount of data
213213
evicts is significant compared to the amount of restored L2ARC data.
214214
In this case, do not write log blocks in L2ARC in order not to waste space.
215215
.
216-
.It Sy metaslab_aliquot Ns = Ns Sy 524288 Ns B Po 512kB Pc Pq ulong
216+
.It Sy metaslab_aliquot Ns = Ns Sy 1048576 Ns B Po 1MB Pc Pq ulong
217217
Metaslab granularity, in bytes.
218218
This is roughly similar to what would be referred to as the "stripe size"
219219
in traditional RAID arrays.
220-
In normal operation, ZFS will try to write this amount of data
221-
to a top-level vdev before moving on to the next one.
220+
In normal operation, ZFS will try to write this amount of data to each disk
221+
before moving on to the next top-level vdev.
222222
.
223223
.It Sy metaslab_bias_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
224224
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-
unsigned long 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.
@@ -899,7 +899,8 @@ metaslab_group_activate(metaslab_group_t *mg)
899899
if (++mg->mg_activation_count <= 0)
900900
return;
901901

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

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

0 commit comments

Comments
 (0)