summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-07-23 07:52:00 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:08 -0400
commit9c859dc91b5a85bab4dcb72087528c6cfd7207b4 (patch)
treedec16b4cf79414c55ef5b6e44f2c41cb9df6cacc /fs/bcachefs/journal_io.c
parent60476b14b4c4e7a733047374aa135fb16c6ab340 (diff)
downloadlwn-9c859dc91b5a85bab4dcb72087528c6cfd7207b4.tar.gz
lwn-9c859dc91b5a85bab4dcb72087528c6cfd7207b4.zip
bcachefs: Assorted journal refactoring
Also improve error reporting - only return an error from bch2_journal_flush_seq() if we had an error writing that entry (i.e. not if there was an error with a newer entry). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.c')
-rw-r--r--fs/bcachefs/journal_io.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index dd423e79a65c..00c454673a04 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1209,6 +1209,8 @@ static void journal_write_done(struct closure *cl)
u64 seq = le64_to_cpu(w->data->seq);
u64 last_seq = le64_to_cpu(w->data->last_seq);
+ bch2_time_stats_update(j->write_time, j->write_start_time);
+
if (!devs.nr) {
bch_err(c, "unable to write journal to sufficient devices");
goto err;
@@ -1216,11 +1218,11 @@ static void journal_write_done(struct closure *cl)
if (bch2_mark_replicas(c, BCH_DATA_JOURNAL, devs))
goto err;
-out:
- bch2_time_stats_update(j->write_time, j->write_start_time);
spin_lock(&j->lock);
+ j->seq_ondisk = seq;
j->last_seq_ondisk = last_seq;
+
if (seq >= j->pin.front)
journal_seq_pin(j, seq)->devs = devs;
@@ -1232,7 +1234,7 @@ out:
* bch2_fs_journal_stop():
*/
mod_delayed_work(system_freezable_wq, &j->reclaim_work, 0);
-
+out:
/* also must come before signalling write completion: */
closure_debug_destroy(cl);
@@ -1250,6 +1252,7 @@ out:
err:
bch2_fatal_error(c);
bch2_journal_halt(j);
+ spin_lock(&j->lock);
goto out;
}