skiselkov commented on this pull request.


> +             uint64_t end;
+               if (cur < rs->rs_start)
+                       cur = rs->rs_start;
+               end = MIN(cur + (max_bytes - trimmed_space), rs->rs_end);
+               metaslab_trim_add(msp, cur, end - cur);
+               trimmed_space += (end - cur);
+               cur = end;
+               if (cur == rs->rs_end)
+                       rs = AVL_NEXT(&msp->ms_tree->rt_root, rs);
+       }
+
+       if (trimmed_space != 0) {
+               /* Force this trim to take place ASAP. */
+               msp->ms_prev_ts = msp->ms_cur_ts;
+               msp->ms_cur_ts = range_tree_create(NULL, NULL, &msp->ms_lock);
+               trim_io = metaslab_exec_trim(msp, B_FALSE);

That was the exact motivation, to reuse the `metaslab_trim_add` and 
`metaslab_exec_trim` logic. It simplified the logic a bit to have manual trim 
simply piggyback onto the autotrim mechanism (which was developed first).

-- 
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_r114456468
------------------------------------------
openzfs-developer
Archives: https://openzfs.topicbox-beta.com/groups/developer/
Powered by Topicbox: https://topicbox-beta.com

Reply via email to