diff options
author | Qu Wenruo <wqu@suse.com> | 2024-12-19 07:34:08 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-01-13 16:53:18 +0300 |
commit | 882af9f13e830c0a4ef696bb72cd5998a5067a93 (patch) | |
tree | 330c8ff09d3aa22044bd182b77fba3bbdf4d3219 /scripts/lib/kdoc/kdoc_files.py | |
parent | 6a2b3d7a36df2c7a7ad3a8ef00bc4ea194221c02 (diff) | |
download | linux-882af9f13e830c0a4ef696bb72cd5998a5067a93.tar.xz |
btrfs: handle free space tree rebuild in multiple transactions
During free space tree rebuild, we're holding a transaction handle for
the whole rebuild process.
This can lead to blocked task warning, e.g. btrfs-transaction kthread
(which is already created before btrfs_start_pre_rw_mount()) can be
waked up to join and commit the current transaction.
But the free space tree rebuild process may need to go through thousands
block groups, this will block btrfs-transaction kthread for a long time.
Fix the problem by calling btrfs_should_end_transaction() after each
block group, so that we won't hold the transaction handle too long.
And since the free-space-tree rebuild can be split into
multiple transactions, we need to consider the safety when the rebuild
process is interrupted.
Thankfully since we only set the FREE_SPACE_TREE compat_ro flag without
FREE_SPACE_TREE_VALID flag, even if the rebuild is interrupted, on the
next RW mount, we will still go rebuild the free space tree, by deleting
any items we have and re-starting the rebuild from scratch.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions