Lines Matching refs:ioend
1060 * We're now finished for good with this ioend structure. Update the page
1062 * ioend after this.
1065 iomap_finish_ioend(struct iomap_ioend *ioend, int error)
1067 struct inode *inode = ioend->io_inode;
1068 struct bio *bio = &ioend->io_inline_bio;
1069 struct bio *last = ioend->io_bio, *next;
1071 loff_t offset = ioend->io_offset;
1074 for (bio = &ioend->io_inline_bio; bio; bio = next) {
1079 * For the last bio, bi_private points to the ioend, so we
1093 /* The ioend has been freed by bio_put() */
1103 iomap_finish_ioends(struct iomap_ioend *ioend, int error)
1107 list_replace_init(&ioend->io_list, &tmp);
1108 iomap_finish_ioend(ioend, error);
1111 ioend = list_first_entry(&tmp, struct iomap_ioend, io_list);
1112 list_del_init(&ioend->io_list);
1113 iomap_finish_ioend(ioend, error);
1122 iomap_ioend_can_merge(struct iomap_ioend *ioend, struct iomap_ioend *next)
1124 if (ioend->io_bio->bi_status != next->io_bio->bi_status)
1126 if ((ioend->io_flags & IOMAP_F_SHARED) ^
1129 if ((ioend->io_type == IOMAP_UNWRITTEN) ^
1132 if (ioend->io_offset + ioend->io_size != next->io_offset)
1138 iomap_ioend_try_merge(struct iomap_ioend *ioend, struct list_head *more_ioends,
1139 void (*merge_private)(struct iomap_ioend *ioend,
1144 INIT_LIST_HEAD(&ioend->io_list);
1148 if (!iomap_ioend_can_merge(ioend, next))
1150 list_move_tail(&next->io_list, &ioend->io_list);
1151 ioend->io_size += next->io_size;
1153 merge_private(ioend, next);
1181 struct iomap_ioend *ioend = bio->bi_private;
1183 iomap_finish_ioend(ioend, blk_status_to_errno(bio->bi_status));
1187 * Submit the final bio for an ioend.
1195 iomap_submit_ioend(struct iomap_writepage_ctx *wpc, struct iomap_ioend *ioend,
1198 ioend->io_bio->bi_private = ioend;
1199 ioend->io_bio->bi_end_io = iomap_writepage_end_bio;
1202 error = wpc->ops->prepare_ioend(ioend, error);
1205 * If we are failing the IO now, just mark the ioend with an
1207 * as there is only one reference to the ioend at this point in
1210 ioend->io_bio->bi_status = errno_to_blk_status(error);
1211 bio_endio(ioend->io_bio);
1215 submit_bio(ioend->io_bio);
1223 struct iomap_ioend *ioend;
1233 ioend = container_of(bio, struct iomap_ioend, io_inline_bio);
1234 INIT_LIST_HEAD(&ioend->io_list);
1235 ioend->io_type = wpc->iomap.type;
1236 ioend->io_flags = wpc->iomap.flags;
1237 ioend->io_inode = inode;
1238 ioend->io_size = 0;
1239 ioend->io_offset = offset;
1240 ioend->io_private = NULL;
1241 ioend->io_bio = bio;
1242 return ioend;
1274 (wpc->ioend->io_flags & IOMAP_F_SHARED))
1276 if (wpc->iomap.type != wpc->ioend->io_type)
1278 if (offset != wpc->ioend->io_offset + wpc->ioend->io_size)
1280 if (sector != bio_end_sector(wpc->ioend->io_bio))
1286 * Test to see if we have an existing ioend structure that we could append to
1287 * first, otherwise finish off the current ioend and start another.
1299 if (!wpc->ioend || !iomap_can_add_to_ioend(wpc, offset, sector)) {
1300 if (wpc->ioend)
1301 list_add(&wpc->ioend->io_list, iolist);
1302 wpc->ioend = iomap_alloc_ioend(inode, wpc, offset, sector, wbc);
1305 merged = __bio_try_merge_page(wpc->ioend->io_bio, page, len, poff,
1311 if (bio_full(wpc->ioend->io_bio, len)) {
1312 wpc->ioend->io_bio =
1313 iomap_chain_bio(wpc->ioend->io_bio);
1315 bio_add_page(wpc->ioend->io_bio, page, len, poff);
1318 wpc->ioend->io_size += len;
1323 * We implement an immediate ioend submission policy here to avoid needing to
1325 * forward progress guarantees we need to provide. The current ioend we are
1327 * does not append to the cached ioend it will create a new ioend and cache that
1330 * If a new ioend is created and cached, the old ioend is returned and queued
1335 * At the end of a writeback pass, there will be a cached ioend remaining on the
1344 struct iomap_ioend *ioend, *next;
1376 WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));
1382 * We cannot cancel the ioend directly here on error. We may have
1390 * failed to map. If the page wasn't been added to ioend, it
1408 * submission errors here and propagate into subsequent ioend
1411 list_for_each_entry_safe(ioend, next, &submit_list, io_list) {
1414 list_del_init(&ioend->io_list);
1415 error2 = iomap_submit_ioend(wpc, ioend, error);
1546 if (!wpc->ioend)
1548 return iomap_submit_ioend(wpc, wpc->ioend, ret);
1561 if (!wpc->ioend)
1563 return iomap_submit_ioend(wpc, wpc->ioend, ret);