summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-01-29 13:58:10 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:52 -0400
commita28bd48a7fc15c99222059a796b3a3c29184b899 (patch)
tree584f2289d068a2fc4b989a67d38bedf6fea96314 /fs/bcachefs
parentd042b0402cff3278d9fa6056cf3d3063bf196716 (diff)
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>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/bcachefs.h1
-rw-r--r--fs/bcachefs/journal_io.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 19ba23f7d9dd..bd675b88b354 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 252993ffcb1b..60cefb4ace45 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)