Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use deferred free mechanism for autotrim
Current autotrim has very high overhead: 1. Select a metaslab that needs to be trimmed, and disable it. 2. Push the issued zio_trim() into txg sync pipline by calling txg_wait_synced(). Wait for the txg (tx_open_txg + 2) to be synced. 3. Enable the metaslab. In this patch, I added ms_trimming, ms_trimmed, ms_trimmed_defer[2] to metaslab to track autotrim process. Here are the steps after the patch: 1. Select a metaslab that needs to be trimmed, only grab the ms_lock. 2. If the metaslab is loaded, move all the ms_trim ranges from ms_allocatable to ms_trimming, so that these trimming ranges will not be allocated. Then release ms_lock. 3. After issuing all the zio_trim(), move all the trimming ranges from ms_trimming to ms_trimmed. 4. The trimmed ranges will go through ms_trimmed_defer[2], after that, the trimmed ranges will be released back to ms_allocatable. Benefits: No metaslab_disable(), no txg_wait_synced(). txg_wait_synced() cause short-lived txgs, and fragmentation. Signed-off-by: jxdking <lostking2008@hotmail.com>
- Loading branch information
Showing
3 changed files
with
248 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.