From 586bdd95a54efe22bbcf36578b88d68aaa78876f Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Tue, 1 Jan 2019 20:10:31 -0600 Subject: [PATCH] Preserve activation flags when sorting metaslabs Also, comment-out the ASSERT(!metaslab_should_allocate(msp, asize)); in metaslab_group_alloc_normal(). It seems that the additional metaslab_group_sort() performed by trim makes this assertion invalid. --- module/zfs/metaslab.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index be8f3e26bfa9..a61e4e382f06 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -3271,7 +3271,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_alloc_list_t *zal, * we may end up in an infinite loop retrying the same * metaslab. */ - ASSERT(!metaslab_should_allocate(msp, asize)); + /* ASSERT(!metaslab_should_allocate(msp, asize)); XXX */ mutex_exit(&msp->ms_lock); } mutex_exit(&msp->ms_lock); @@ -4687,7 +4687,8 @@ metaslab_exec_trim(metaslab_t *msp, boolean_t auto_trim) * don't know which buckets to alter with what we have in * trim_tree. */ - metaslab_group_sort(msp->ms_group, msp, metaslab_weight(msp)); + metaslab_group_sort(msp->ms_group, msp, metaslab_weight(msp) | + (msp->ms_weight & METASLAB_ACTIVE_MASK)); } if (auto_trim) {