• Kent Overstreet's avatar
    bcachefs: bch2_btree_iter_peek_all_levels() · b0babf2a
    Kent Overstreet authored
    This adds bch2_btree_iter_peek_all_levels(), which returns keys from
    every level of the btree - interior nodes included - in monotonically
    increasing order, soon to be used by the backpointers check & repair
    code.
    
     - BTREE_ITER_ALL_LEVELS can now be passed to for_each_btree_key() to
       iterate thusly, much like BTREE_ITER_SLOTS
    
     - The existing algorithm in bch2_btree_iter_advance() doesn't work with
       peek_all_levels(): we have to defer the actual advancing until the
       next time we call peek, where we have the btree path traversed and
       uptodate. So, we add an advanced bit to btree_iter; when
       BTREE_ITER_ALL_LEVELS is set bch2_btree_iter_advanced() just marks
       the iterator as advanced.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    b0babf2a
btree_iter.h 13.9 KB