bcachefs: assertion to catch outstanding bug
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 8 Mar 2019 00:45:57 +0000 (19:45 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:17 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/super-io.c

index 66e174d93a9c296efe39a2d5b33cebb8c04e48fd..c89fe5d630e46e0b0de40219eb1c806221b798c2 100644 (file)
@@ -1027,7 +1027,10 @@ void bch2_fs_mark_clean(struct bch_fs *c, bool clean)
        sb_clean->flags         = 0;
        sb_clean->read_clock    = cpu_to_le16(c->bucket_clock[READ].hand);
        sb_clean->write_clock   = cpu_to_le16(c->bucket_clock[WRITE].hand);
-       sb_clean->journal_seq   = journal_cur_seq(&c->journal) - 1;
+       sb_clean->journal_seq   = cpu_to_le64(journal_cur_seq(&c->journal) - 1);
+
+       /* Trying to catch outstanding bug: */
+       BUG_ON(le64_to_cpu(sb_clean->journal_seq) > S64_MAX);
 
        entry = sb_clean->start;
        entry = bch2_journal_super_entries_add_common(c, entry, 0);