Commit 16e67103 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Handle ec_buf not being page aligned when allocating bio

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 21629f53
......@@ -461,7 +461,10 @@ static struct bio *bch2_write_bio_alloc(struct bch_fs *c,
struct bio *bio;
unsigned output_available =
min(wp->sectors_free << 9, src->bi_iter.bi_size);
unsigned pages = DIV_ROUND_UP(output_available, PAGE_SIZE);
unsigned pages = DIV_ROUND_UP(output_available +
(buf
? ((unsigned long) buf & (PAGE_SIZE - 1))
: 0), PAGE_SIZE);
bio = bio_alloc_bioset(NULL, pages, 0,
GFP_NOIO, &c->bio_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment