When we're doing writethrough, we don't have a writeback_control to pass in. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- fs/iomap/buffered-io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index a74da66e64a7..2b89c43aedd7 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1213,9 +1213,13 @@ static struct iomap_ioend *iomap_alloc_ioend(struct inode *inode, bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_VECS, &iomap_ioend_bioset); bio_set_dev(bio, iomap->bdev); bio->bi_iter.bi_sector = sector; - bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc); + bio->bi_opf = REQ_OP_WRITE; bio->bi_write_hint = inode->i_write_hint; - wbc_init_bio(wbc, bio); + + if (wbc) { + bio->bi_opf |= wbc_to_write_flags(wbc); + wbc_init_bio(wbc, bio); + } ioend = container_of(bio, struct iomap_ioend, io_inline_bio); INIT_LIST_HEAD(&ioend->io_list); -- 2.30.2