bcachefs: Improve bch2_check_alloc_info
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 20 Jun 2022 02:43:00 +0000 (22:43 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:34 +0000 (17:09 -0400)
commite34da43e33f8c0b42b74bf9aa86042d16884183b
tree4c70991459db76a6769fe8f308fed05ff7794daf
parent22add2ec6705cd66977717c49105e0910b2ef144
bcachefs: Improve bch2_check_alloc_info

 - In check_alloc_key(), previously we were re-initializing iterators
   for the need_discard and freespace btrees for every alloc key we
   checked. But this was causing us to redo lookups into the journal
   keys every time, since those lookups are cached in struct btree_iter.
   This initializes the iterators in bch2_check_alloc_info and passes
   them into check_alloc_key().

 - Make the looping more consistent/efficient in bch2_check_alloc_info()

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/alloc_background.c