diff options
author | Serapheim Dimitropoulos <serapheimd@gmail.com> | 2019-02-20 17:59:57 +0000 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2019-02-20 17:59:56 +0000 |
commit | 928e8ad47d3478a3d5d01f0dd6ae74a9371af65e (patch) | |
tree | 877e0d0920705d870aa96183c305957e94dc5e9d /include/sys/metaslab.h | |
parent | bb1be77a35d3cf5389a36f1d13935811962278c3 (diff) | |
download | src-928e8ad47d3478a3d5d01f0dd6ae74a9371af65e.tar.gz src-928e8ad47d3478a3d5d01f0dd6ae74a9371af65e.zip |
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
Diffstat (limited to 'include/sys/metaslab.h')
-rw-r--r-- | include/sys/metaslab.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/sys/metaslab.h b/include/sys/metaslab.h index fd0d23502a43..a513a647039c 100644 --- a/include/sys/metaslab.h +++ b/include/sys/metaslab.h @@ -119,6 +119,7 @@ void metaslab_group_histogram_remove(metaslab_group_t *, metaslab_t *); void metaslab_group_alloc_decrement(spa_t *, uint64_t, void *, int, int, boolean_t); void metaslab_group_alloc_verify(spa_t *, const blkptr_t *, void *, int); +void metaslab_recalculate_weight_and_sort(metaslab_t *); #ifdef __cplusplus } |