skiselkov commented on this pull request.


> @@ -2162,8 +2184,23 @@ metaslab_condense(metaslab_t *msp, uint64_t txg, 
> dmu_tx_t *tx)
        range_tree_vacate(condense_tree, NULL, NULL);
        range_tree_destroy(condense_tree);
 
-       space_map_write(sm, msp->ms_tree, SM_FREE, tx);
+       if (msp->ms_trimming_ts == NULL) {
+               space_map_write(sm, msp->ms_tree, SM_FREE, tx);
+       } else {
+               /*
+                * While trimming, the stuff being trimmed isn't in ms_tree,
+                * but we still want our persistent state to reflect that. So
+                * we construct a temporary union of the two trees.
+                */
+               range_tree_t *rt = range_tree_create(NULL, NULL, &msp->ms_lock);
+               range_tree_walk(msp->ms_tree, range_tree_add, rt);
+               range_tree_walk(msp->ms_trimming_ts, range_tree_add, rt);

You're right, I'll change that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/172#discussion_r114453577
------------------------------------------
openzfs-developer
Archives: https://openzfs.topicbox.com/groups/developer/
Powered by Topicbox: https://topicbox.com

Reply via email to