summaryrefslogtreecommitdiff
path: root/libbcachefs/journal_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/journal_io.c')
-rw-r--r--libbcachefs/journal_io.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libbcachefs/journal_io.c b/libbcachefs/journal_io.c
index 8a4e7b2a..2a70edc2 100644
--- a/libbcachefs/journal_io.c
+++ b/libbcachefs/journal_io.c
@@ -901,7 +901,7 @@ int bch2_journal_replay(struct bch_fs *c, struct list_head *list)
bch2_disk_reservation_init(c, 0);
ret = bch2_btree_insert(c, entry->btree_id, k,
- &disk_res, NULL, NULL,
+ &disk_res, NULL,
BTREE_INSERT_NOFAIL|
BTREE_INSERT_JOURNAL_REPLAY);
}
@@ -1204,6 +1204,9 @@ static void journal_write_done(struct closure *cl)
struct bch_devs_list devs =
bch2_extent_devs(bkey_i_to_s_c_extent(&w->key));
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");
@@ -1212,11 +1215,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->last_seq_ondisk = seq;
+ j->seq_ondisk = seq;
+ j->last_seq_ondisk = last_seq;
+
if (seq >= j->pin.front)
journal_seq_pin(j, seq)->devs = devs;
@@ -1228,7 +1231,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);
@@ -1246,6 +1249,7 @@ out:
err:
bch2_fatal_error(c);
bch2_journal_halt(j);
+ spin_lock(&j->lock);
goto out;
}
@@ -1385,6 +1389,8 @@ no_io:
extent_for_each_ptr(bkey_i_to_s_extent(&j->key), ptr)
ptr->offset += sectors;
+ bch2_bucket_seq_cleanup(c);
+
continue_at(cl, journal_write_done, system_highpri_wq);
return;
err: