mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Update bcachefs sources to ed88ebf18c bcachefs: Handle last journal write being torn
This commit is contained in:
parent
505230a110
commit
7e0fbb0144
@ -1 +1 @@
|
|||||||
586e7c5498345c048985f6864f07ce36adde48be
|
ed88ebf18cd1ef0a3439ebfdf0059d37bb4d4249
|
||||||
|
@ -1107,7 +1107,7 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
|
|||||||
struct bch_dev *ca;
|
struct bch_dev *ca;
|
||||||
unsigned iter;
|
unsigned iter;
|
||||||
struct printbuf buf = PRINTBUF;
|
struct printbuf buf = PRINTBUF;
|
||||||
bool degraded = false;
|
bool degraded = false, last_write_torn = false;
|
||||||
u64 seq, last_seq = 0;
|
u64 seq, last_seq = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -1143,8 +1143,13 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
|
|||||||
/*
|
/*
|
||||||
* Find most recent flush entry, and ignore newer non flush entries -
|
* Find most recent flush entry, and ignore newer non flush entries -
|
||||||
* those entries will be blacklisted:
|
* those entries will be blacklisted:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* XXX check for torn write on last journal entry
|
||||||
*/
|
*/
|
||||||
genradix_for_each_reverse(&c->journal_entries, radix_iter, _i) {
|
genradix_for_each_reverse(&c->journal_entries, radix_iter, _i) {
|
||||||
|
int write = READ;
|
||||||
|
|
||||||
i = *_i;
|
i = *_i;
|
||||||
|
|
||||||
if (!i || i->ignore)
|
if (!i || i->ignore)
|
||||||
@ -1153,8 +1158,17 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
|
|||||||
if (!*start_seq)
|
if (!*start_seq)
|
||||||
*blacklist_seq = *start_seq = le64_to_cpu(i->j.seq) + 1;
|
*blacklist_seq = *start_seq = le64_to_cpu(i->j.seq) + 1;
|
||||||
|
|
||||||
if (!JSET_NO_FLUSH(&i->j)) {
|
if (JSET_NO_FLUSH(&i->j)) {
|
||||||
int write = READ;
|
journal_replay_free(c, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!last_write_torn && !i->csum_good) {
|
||||||
|
last_write_torn = true;
|
||||||
|
journal_replay_free(c, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (journal_entry_err_on(le64_to_cpu(i->j.last_seq) > le64_to_cpu(i->j.seq),
|
if (journal_entry_err_on(le64_to_cpu(i->j.last_seq) > le64_to_cpu(i->j.seq),
|
||||||
c, &i->j, NULL,
|
c, &i->j, NULL,
|
||||||
"invalid journal entry: last_seq > seq (%llu > %llu)",
|
"invalid journal entry: last_seq > seq (%llu > %llu)",
|
||||||
@ -1167,9 +1181,6 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
journal_replay_free(c, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*start_seq) {
|
if (!*start_seq) {
|
||||||
bch_info(c, "journal read done, but no entries found");
|
bch_info(c, "journal read done, but no entries found");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user