You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
btrfs-progs: optimize the block group item load for half converted fs
[PROBLEM]
If there is an fs which is half converted to block group tree, then the
block group item loading will still go through all the tree blocks in
the old extent tree.
Even if the extent tree may only contain one block group item.
[CAUSE]
We rely on the function find_first_block_group() to find a block group
after certain bytenr.
But there is no stopper on where the search should end, thus it will go
the next slot until there are no more leaves.
Meaning even if we have found the last block group item in the old
extent tree, find_first_block_group() will still search the whole extent
tree.
We had a check after find_first_block_group(), but that's useless as
it's already too late.
[ENHANCEMENT]
Add an extra parameter, @max_bytenr, that if we found a key whose
objectid >= @max_bytenr, then we stop the search immediately.
This will skip the time consuming full tree iteration and make resuming
faster.
Signed-off-by: Qu Wenruo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
0 commit comments