bcachefs: Add a fallback when journal_keys doesn't fit in ram
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 15 Mar 2023 15:02:00 +0000 (11:02 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:57 +0000 (17:09 -0400)
commit26559553e47c9f2a14b5254cb307fc755ac316c8
tree1335ce4efafbd822e300e8db3dca26908c7cc6d0
parent2f0815840c80075bc35f210a7acfa8b48717be5a
bcachefs: Add a fallback when journal_keys doesn't fit in ram

We may end up in a situation where allocating the buffer for the sorted
journal_keys fails - but it would likely succeed, post compaction where
we drop duplicates.

We've had reports of this allocation failing, so this adds a slowpath to
do the compaction incrementally.

This is only a band-aid fix; we need to look at limiting the number of
keys in the journal based on the amount of system RAM.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/recovery.c