diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-23 10:26:10 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-12 20:14:03 -0500 |
commit | 9d578751bfb5838de9cbdf5d9ad53c57a01a25a7 (patch) | |
tree | 1afdceab2408f8cf56d9dc67086eace2c4648257 | |
parent | a11aca21c956485006f8f94bfc8845b188459b8f (diff) |
bcachefs: Fix for journal getting stuck
The journal can get stuck if we need to get a journal reservation for
something we have a pre-reservation for, but aren't able to reclaim
space, or if the pin fifo is full - it's impractical to resize the pin
fifo at runtime.
Previously, we reserved 8 entries in the pin fifo for pre-reservations,
but that seems small - we're seeing the journal occasionally get stuck.
Let's reserve a quarter of it.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/journal.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/journal.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 158df42e5e10..a85ab36d2d17 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -417,7 +417,7 @@ unlock: (flags & JOURNAL_RES_GET_RESERVED)) { char *journal_debug_buf = kmalloc(4096, GFP_ATOMIC); - bch_err(c, "Journal stuck!"); + bch_err(c, "Journal stuck! Hava a pre-reservation but journal full"); if (journal_debug_buf) { bch2_journal_debug_to_text(&_PBUF(journal_debug_buf, 4096), j); bch_err(c, "%s", journal_debug_buf); diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index b298873212d2..d3202f53d5b3 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -374,7 +374,7 @@ static inline bool journal_check_may_get_unreserved(struct journal *j) { union journal_preres_state s = READ_ONCE(j->prereserved); bool ret = s.reserved < s.remaining && - fifo_free(&j->pin) > 8; + fifo_free(&j->pin) > j->pin.size / 4; lockdep_assert_held(&j->lock); |