mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
bcachefs: pass last_seq into fs_journal_start()
Prep work for journal rewind, where the seq we're replaying from may be different than the last journal entry's last_seq. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f2ed089273
commit
2ba562cc04
3 changed files with 9 additions and 15 deletions
|
@ -1474,14 +1474,13 @@ void bch2_fs_journal_stop(struct journal *j)
|
|||
clear_bit(JOURNAL_running, &j->flags);
|
||||
}
|
||||
|
||||
int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
|
||||
int bch2_fs_journal_start(struct journal *j, u64 last_seq, u64 cur_seq)
|
||||
{
|
||||
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
||||
struct journal_entry_pin_list *p;
|
||||
struct journal_replay *i, **_i;
|
||||
struct genradix_iter iter;
|
||||
bool had_entries = false;
|
||||
u64 last_seq = cur_seq, nr, seq;
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -1495,17 +1494,11 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
genradix_for_each_reverse(&c->journal_entries, iter, _i) {
|
||||
i = *_i;
|
||||
/* Clean filesystem? */
|
||||
if (!last_seq)
|
||||
last_seq = cur_seq;
|
||||
|
||||
if (journal_replay_ignore(i))
|
||||
continue;
|
||||
|
||||
last_seq = le64_to_cpu(i->j.last_seq);
|
||||
break;
|
||||
}
|
||||
|
||||
nr = cur_seq - last_seq;
|
||||
u64 nr = cur_seq - last_seq;
|
||||
|
||||
/*
|
||||
* Extra fudge factor, in case we crashed when the journal pin fifo was
|
||||
|
@ -1532,6 +1525,7 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
|
|||
j->pin.back = cur_seq;
|
||||
atomic64_set(&j->seq, cur_seq - 1);
|
||||
|
||||
u64 seq;
|
||||
fifo_for_each_entry_ptr(p, &j->pin, seq)
|
||||
journal_pin_list_init(p, 1);
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ int bch2_fs_journal_alloc(struct bch_fs *);
|
|||
void bch2_dev_journal_stop(struct journal *, struct bch_dev *);
|
||||
|
||||
void bch2_fs_journal_stop(struct journal *);
|
||||
int bch2_fs_journal_start(struct journal *, u64);
|
||||
int bch2_fs_journal_start(struct journal *, u64, u64);
|
||||
void bch2_journal_set_replay_done(struct journal *);
|
||||
|
||||
void bch2_dev_journal_exit(struct bch_dev *);
|
||||
|
|
|
@ -965,7 +965,7 @@ use_clean:
|
|||
|
||||
ret = bch2_journal_log_msg(c, "starting journal at entry %llu, replaying %llu-%llu",
|
||||
journal_seq, last_seq, blacklist_seq - 1) ?:
|
||||
bch2_fs_journal_start(&c->journal, journal_seq);
|
||||
bch2_fs_journal_start(&c->journal, last_seq, journal_seq);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ int bch2_fs_initialize(struct bch_fs *c)
|
|||
* journal_res_get() will crash if called before this has
|
||||
* set up the journal.pin FIFO and journal.cur pointer:
|
||||
*/
|
||||
ret = bch2_fs_journal_start(&c->journal, 1);
|
||||
ret = bch2_fs_journal_start(&c->journal, 1, 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue