aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-18 16:42:50 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-04-20 19:41:38 -0400
commit6468aef231890806ccc4e921b111ff9275880832 (patch)
treeb86973bd8fc3e5212d58605ab96dc445441856d6 /fs
parent71f8e806a5e4edada72456ee3b2e2d7eab6fadee (diff)
downloadath-6468aef231890806ccc4e921b111ff9275880832.tar.gz
bcachefs: Ensure journal space is block size aligned
We don't require that bucket size is block size aligned (although it should be!) - so we need to handle this in the journal code. This fixes an assertion pop in jorunal_entry_close(), where the journal entry overruns available space - after rounding it up to block size. Fixes: https://github.com/koverstreet/bcachefs/issues/854 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/journal_reclaim.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index 5d1547aa118ac..ea670c3c43d8a 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -252,7 +252,10 @@ void bch2_journal_space_available(struct journal *j)
bch2_journal_set_watermark(j);
out:
- j->cur_entry_sectors = !ret ? j->space[journal_space_discarded].next_entry : 0;
+ j->cur_entry_sectors = !ret
+ ? round_down(j->space[journal_space_discarded].next_entry,
+ block_sectors(c))
+ : 0;
j->cur_entry_error = ret;
if (!ret)