From: Kent Overstreet Date: Fri, 29 Jan 2021 18:58:10 +0000 (-0500) Subject: bcachefs: Add an assertion to check for journal writes to same location X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a28bd48a7fc15c99222059a796b3a3c29184b899;p=linux.git bcachefs: Add an assertion to check for journal writes to same location Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 19ba23f7d9dda..bd675b88b3541 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -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; diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index 252993ffcb1b1..60cefb4ace45f 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -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)