Skip to content
  • Qu Wenruo's avatar
    btrfs: qgroup: Introduce function to find all new tree blocks of reloc tree · ea49f3e7
    Qu Wenruo authored
    
    
    Introduce new function, qgroup_trace_new_subtree_blocks(), to iterate
    all new tree blocks in a reloc tree.
    So that qgroup could skip unrelated tree blocks during balance, which
    should hugely speedup balance speed when quota is enabled.
    
    The function qgroup_trace_new_subtree_blocks() itself only cares about
    new tree blocks in reloc tree.
    
    All its main works are:
    
    1) Read out tree blocks according to parent pointers
    
    2) Do recursive depth-first search
       Will call the same function on all its children tree blocks, with
       search level set to current level -1.
       And will also skip all children whose generation is smaller than
       @last_snapshot.
    
    3) Call qgroup_trace_extent_swap() to trace tree blocks
    
    So although we have parameter list related to source file tree, it's not
    used at all, but only passed to qgroup_trace_extent_swap().
    Thus despite the tree read code, the core should be pretty short and all
    about recursive depth-first search.
    
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ea49f3e7