bcachefs: Add missing EBUG_ON
authorAlan Huang <mmpgouride@gmail.com>
Thu, 12 Jun 2025 19:01:58 +0000 (03:01 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 16 Jun 2025 02:11:55 +0000 (22:11 -0400)
Just like the EBUG_ON in bch2_journal_add_entry().

Signed-off-by: Alan Huang <mmpgouride@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_trans_commit.c

index d9710801e3eee504bc813b4e971a4fc1f7ca4792..55952143f0d379545be51f05dd5b1f2c28574047 100644 (file)
@@ -757,6 +757,8 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
                                  btree_trans_journal_entries_start(trans),
                                  trans->journal_entries.u64s);
 
+               EBUG_ON(trans->journal_res.u64s < trans->journal_entries.u64s);
+
                trans->journal_res.offset       += trans->journal_entries.u64s;
                trans->journal_res.u64s         -= trans->journal_entries.u64s;