Skip to content

Commit ada02c2

Browse files
Brian FosterKent Overstreet
authored andcommitted
bcachefs: fix lost journal buf wakeup due to improved pipelining
The journal_write_done() handler was reworked into a loop in commit 746a33c ("bcachefs: better journal pipelining"). As part of this, the journal buffer wake was factored into a post-loop branch that executes if at least one journal buffer has completed. The journal buffer processing loop iterates on the journal buffer pointer, however. This means that w refers to the last buffer processed by the loop, which may or may not be done. This also means that if multiple buffers are processed by the loop, only the last is awoken. This lost wakeup behavior has lead to stalling problems in various CI and fstests, such as generic/703. Lift the wake into the loop so each done buffer sees a wake call as it is processed. Signed-off-by: Brian Foster <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 2a68d61 commit ada02c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/journal_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,7 @@ static CLOSURE_CALLBACK(journal_write_done)
16721672
new.unwritten_idx++;
16731673
} while ((v = atomic64_cmpxchg(&j->reservations.counter, old.v, new.v)) != old.v);
16741674

1675+
closure_wake_up(&w->wait);
16751676
completed = true;
16761677
}
16771678

@@ -1682,7 +1683,6 @@ static CLOSURE_CALLBACK(journal_write_done)
16821683
track_event_change(&c->times[BCH_TIME_blocked_journal_max_in_flight],
16831684
&j->max_in_flight_start, false);
16841685

1685-
closure_wake_up(&w->wait);
16861686
journal_wake(j);
16871687
}
16881688

0 commit comments

Comments
 (0)