diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-08-22 16:41:50 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:25 -0400 |
commit | 16e671037a4ca9d695134151d9bc58069d24b094 (patch) | |
tree | e41c548fbc679eb5a524a1c94898926ef0fcb64e /fs/bcachefs/io.c | |
parent | 21629f536808c7a0e7791a2711944b03d820749f (diff) | |
download | lwn-16e671037a4ca9d695134151d9bc58069d24b094.tar.gz lwn-16e671037a4ca9d695134151d9bc58069d24b094.zip |
bcachefs: Handle ec_buf not being page aligned when allocating bio
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r-- | fs/bcachefs/io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index 5db83374403b..117d1faa99f2 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -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); |