init_layout(): fix rounding

block_size is in bytes, not sectors, so when calling round_up(),
we could start rounding up by a way too large size and then overflow
outside the area that migrate allocated for us.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Steinar H. Gunderson 2024-01-12 18:56:49 +01:00 committed by Kent Overstreet
parent 2b7fda5aee
commit b6afe1bed4

View File

@ -48,7 +48,7 @@ static void init_layout(struct bch_sb_layout *l,
/* Create two superblocks in the allowed range: */
for (i = 0; i < l->nr_superblocks; i++) {
if (sb_pos != BCH_SB_SECTOR)
sb_pos = round_up(sb_pos, block_size);
sb_pos = round_up(sb_pos, block_size >> 9);
l->sb_offset[i] = cpu_to_le64(sb_pos);
sb_pos += sb_size;