bcachefs: Add an assertion to check for journal writes to same location

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2021-01-29 13:58:10 -05:00 committed by Kent Overstreet
parent d042b0402c
commit a28bd48a7f
2 changed files with 4 additions and 0 deletions

View File

@ -473,6 +473,7 @@ struct bch_dev {
atomic64_t rebalance_work;
struct journal_device journal;
u64 prev_journal_sector;
struct work_struct io_error_work;

View File

@ -1286,6 +1286,9 @@ static void do_journal_write(struct closure *cl)
bio->bi_end_io = journal_write_endio;
bio->bi_private = ca;
BUG_ON(bio->bi_iter.bi_sector == ca->prev_journal_sector);
ca->prev_journal_sector = bio->bi_iter.bi_sector;
if (!JSET_NO_FLUSH(w->data))
bio->bi_opf |= REQ_FUA;
if (!JSET_NO_FLUSH(w->data) && !w->separate_flush)