]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Introduce auxiliary metaslab histograms
authorSerapheim Dimitropoulos <serapheimd@gmail.com>
Wed, 20 Feb 2019 17:59:57 +0000 (09:59 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 Feb 2019 17:59:56 +0000 (09:59 -0800)
commit928e8ad47d3478a3d5d01f0dd6ae74a9371af65e
tree877e0d0920705d870aa96183c305957e94dc5e9d
parentbb1be77a35d3cf5389a36f1d13935811962278c3
Introduce auxiliary metaslab histograms

This patch introduces 3 new histograms per metaslab. These
histograms track segments that have made it to the metaslab's
space map histogram (and are part of the spacemap) but have
not yet reached the ms_allocatable tree on loaded metaslab's
because these metaslab's are currently syncing and haven't
gone through metaslab_sync_done() yet.

The histograms help when we decide whether to load an unloaded
metaslab in-order to allocate from it. When calculating the
weight of an unloaded metaslab traditionally, we look at the
highest bucket of its spacemap's histogram.  The problem is
that we are not guaranteed to be able to allocated that
segment when we load the metaslab because it may still be at
the freeing, freed, or defer trees. The new histograms are
used when we try to calculate an unloaded metaslab's weight
to deal with this issue by removing segments that have would
not be in the allocatable tree at runtime. Note, that this
method of dealing with this is not completely accurate as
adjacent segments are not always consolidated in the space
map histogram of a metaslab.

In addition and to make things deterministic, we always reset
the weight of unloaded metaslabs based on their space map
weight (instead of doing that on a need basis). Thus, every
time a metaslab is loaded and its weight is reset again (from
the weight based on its space map to the one based on its
allocatable range tree) we expect (and assert) that this
change in weight can only get better if it doesn't stay the
same.

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #8358
include/sys/metaslab.h
include/sys/metaslab_impl.h
include/sys/space_map.h
module/zfs/metaslab.c
module/zfs/vdev.c