bcachefs: refactor journal stuck checking into standalone helper
authorBrian Foster <bfoster@redhat.com>
Tue, 21 Mar 2023 12:03:18 +0000 (08:03 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:58 +0000 (17:09 -0400)
commitdb1bf7290591115e4d37428ff822c20a1694a69b
treebfad2989606fa15643e9f6d1d2af803bd7a6ae45
parent23fd4f4dc622c36124515401d223607baec01a0d
bcachefs: refactor journal stuck checking into standalone helper

bcachefs checks for journal stuck conditions both in the journal
space calculation code and the journal reservation slow path. The
logic in both places is rather tricky and can result in
non-deterministic failure characteristics and debug output.

In preparation to condense journal stuck handling to a single place,
refactor the __journal_res_get() logic into a standalone helper.
Since multiple callers into the reservation code can result in
duplicate reports, use the ->err_seq field as a serialization
mechanism for the debug dump. Finally, add some comments to help
explain the logic and hopefully facilitate further improvements in
the future.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c