@@ -239,14 +239,23 @@ static void iomap_dio_zero(const struct iomap_iter *iter, struct iomap_dio *dio,
struct page *page = ZERO_PAGE(0);
struct bio *bio;
- bio = iomap_dio_alloc_bio(iter, dio, 1, REQ_OP_WRITE | REQ_SYNC | REQ_IDLE);
+ WARN_ON_ONCE(len > (BIO_MAX_VECS * PAGE_SIZE));
+
+ bio = iomap_dio_alloc_bio(iter, dio, BIO_MAX_VECS,
+ REQ_OP_WRITE | REQ_SYNC | REQ_IDLE);
fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits,
GFP_KERNEL);
+
bio->bi_iter.bi_sector = iomap_sector(&iter->iomap, pos);
bio->bi_private = dio;
bio->bi_end_io = iomap_dio_bio_end_io;
- __bio_add_page(bio, page, len, 0);
+ while (len) {
+ unsigned int io_len = min_t(unsigned int, len, PAGE_SIZE);
+
+ __bio_add_page(bio, page, io_len, 0);
+ len -= io_len;
+ }
iomap_dio_submit_bio(iter, dio, bio, pos);
}