HomeFreeBSD

Fix metaslab group fragmentation math (#17037)

Description

Fix metaslab group fragmentation math (#17037)

Since we are calculating a free space fragmentation, we should
weight metaslabs by the amount of their free space, not a full
size. Fragmentation of full metaslabs may not matter in presence
empty ones. The old algorithm did not differentiate metaslabs
having only one free 4KB block from metaslabs having 50% of space
free in 4KB blocks, reporting higher fragmentation.

While there, move metaslab_group_alloc_update() call after setting
mg_fragmentation, otherwise the effect may be delayed by one TXG.

Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>

Details

Provenance
mavAuthored on Tue, Feb 18, 6:45 PM
GitHub <noreply@github.com>Committed on Tue, Feb 18, 6:45 PM
Parents
rG68473c4fd847: range_tree: convert remaining range_* defs to zfs_range_*
Branches
Unknown
Tags
Unknown