• Kent Overstreet's avatar
    bcachefs: bch2_bkey_get_iter() helpers · bcb79a51
    Kent Overstreet authored
    Introduce new helpers for a common pattern:
    
      bch2_trans_iter_init();
      bch2_btree_iter_peek_slot();
    
     - bch2_bkey_get_iter_type() returns -ENOENT if it doesn't find a key of
       the correct type
     - bch2_bkey_get_val_typed() copies the val out of the btree to a
       (typically stack allocated) variable; it handles the case where the
       value in the btree is smaller than the current version of the type,
       zeroing out the remainder.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    bcb79a51
btree_iter.h 27.1 KB