Lines Matching defs:wpc

1656 static int iomap_submit_ioend(struct iomap_writepage_ctx *wpc, int error)
1658 if (!wpc->ioend)
1667 if (wpc->ops->prepare_ioend)
1668 error = wpc->ops->prepare_ioend(wpc->ioend, error);
1671 wpc->ioend->io_bio.bi_status = errno_to_blk_status(error);
1672 bio_endio(&wpc->ioend->io_bio);
1674 submit_bio(&wpc->ioend->io_bio);
1677 wpc->ioend = NULL;
1681 static struct iomap_ioend *iomap_alloc_ioend(struct iomap_writepage_ctx *wpc,
1687 bio = bio_alloc_bioset(wpc->iomap.bdev, BIO_MAX_VECS,
1690 bio->bi_iter.bi_sector = iomap_sector(&wpc->iomap, pos);
1697 ioend->io_type = wpc->iomap.type;
1698 ioend->io_flags = wpc->iomap.flags;
1704 wpc->nr_folios = 0;
1708 static bool iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t pos)
1710 if ((wpc->iomap.flags & IOMAP_F_SHARED) !=
1711 (wpc->ioend->io_flags & IOMAP_F_SHARED))
1713 if (wpc->iomap.type != wpc->ioend->io_type)
1715 if (pos != wpc->ioend->io_offset + wpc->ioend->io_size)
1717 if (iomap_sector(&wpc->iomap, pos) !=
1718 bio_end_sector(&wpc->ioend->io_bio))
1725 if (wpc->nr_folios >= IOEND_BATCH_SIZE)
1741 static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc,
1749 if (!wpc->ioend || !iomap_can_add_to_ioend(wpc, pos)) {
1751 error = iomap_submit_ioend(wpc, 0);
1754 wpc->ioend = iomap_alloc_ioend(wpc, wbc, inode, pos);
1757 if (!bio_add_folio(&wpc->ioend->io_bio, folio, len, poff))
1762 wpc->ioend->io_size += len;
1767 static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
1777 error = wpc->ops->map_blocks(wpc, inode, pos, dirty_len);
1780 trace_iomap_writepage_map(inode, pos, dirty_len, &wpc->iomap);
1783 wpc->iomap.offset + wpc->iomap.length - pos);
1786 switch (wpc->iomap.type) {
1794 error = iomap_add_to_ioend(wpc, wbc, folio, inode, pos,
1813 if (error && wpc->ops->discard_folio)
1814 wpc->ops->discard_folio(folio, pos);
1876 static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,
1925 error = iomap_writepage_map_blocks(wpc, wbc, folio, inode,
1933 wpc->nr_folios++;
1969 struct iomap_writepage_ctx *wpc,
1982 wpc->ops = ops;
1983 ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc);
1984 return iomap_submit_ioend(wpc, ret);