Commit 7efa2875 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix bch2_journal_noflush_seq()

Improved journal pipelining broke journal_noflush_seq(); it implicitly
assumed only the oldest outstanding journal buf could be in flight, but
that's no longer true.

Make this more straightforward by just setting buf->must_flush whenever
we know a journal buf is going to be flush.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 79162e82
...@@ -716,7 +716,7 @@ int bch2_journal_flush_seq_async(struct journal *j, u64 seq, ...@@ -716,7 +716,7 @@ int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
return ret; return ret;
seq = res.seq; seq = res.seq;
buf = j->buf + (seq & JOURNAL_BUF_MASK); buf = journal_seq_to_buf(j, seq);
buf->must_flush = true; buf->must_flush = true;
if (!buf->flush_time) { if (!buf->flush_time) {
...@@ -734,8 +734,8 @@ int bch2_journal_flush_seq_async(struct journal *j, u64 seq, ...@@ -734,8 +734,8 @@ int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
} }
/* /*
* if write was kicked off without a flush, flush the next sequence * if write was kicked off without a flush, or if we promised it
* number instead * wouldn't be a flush, flush the next sequence number instead
*/ */
buf = journal_seq_to_buf(j, seq); buf = journal_seq_to_buf(j, seq);
if (buf->noflush) { if (buf->noflush) {
...@@ -813,8 +813,8 @@ bool bch2_journal_noflush_seq(struct journal *j, u64 seq) ...@@ -813,8 +813,8 @@ bool bch2_journal_noflush_seq(struct journal *j, u64 seq)
unwritten_seq++) { unwritten_seq++) {
struct journal_buf *buf = journal_seq_to_buf(j, unwritten_seq); struct journal_buf *buf = journal_seq_to_buf(j, unwritten_seq);
/* journal write is already in flight, and was a flush write: */ /* journal flush already in flight, or flush requseted */
if (unwritten_seq == journal_last_unwritten_seq(j) && !buf->noflush) if (buf->must_flush)
goto out; goto out;
buf->noflush = true; buf->noflush = true;
......
...@@ -1936,6 +1936,7 @@ static int bch2_journal_write_pick_flush(struct journal *j, struct journal_buf * ...@@ -1936,6 +1936,7 @@ static int bch2_journal_write_pick_flush(struct journal *j, struct journal_buf *
j->nr_noflush_writes++; j->nr_noflush_writes++;
} else { } else {
w->must_flush = true;
j->last_flush_write = jiffies; j->last_flush_write = jiffies;
j->nr_flush_writes++; j->nr_flush_writes++;
clear_bit(JOURNAL_NEED_FLUSH_WRITE, &j->flags); clear_bit(JOURNAL_NEED_FLUSH_WRITE, &j->flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment