Lines Matching refs:ioend

29 	struct xfs_ioend	*ioend;  member
85 struct xfs_ioend *ioend, in xfs_destroy_ioend() argument
88 struct inode *inode = ioend->io_inode; in xfs_destroy_ioend()
89 struct bio *bio = &ioend->io_inline_bio; in xfs_destroy_ioend()
90 struct bio *last = ioend->io_bio, *next; in xfs_destroy_ioend()
94 for (bio = &ioend->io_inline_bio; bio; bio = next) { in xfs_destroy_ioend()
122 static inline bool xfs_ioend_is_append(struct xfs_ioend *ioend) in xfs_ioend_is_append() argument
124 return ioend->io_offset + ioend->io_size > in xfs_ioend_is_append()
125 XFS_I(ioend->io_inode)->i_d.di_size; in xfs_ioend_is_append()
130 struct xfs_ioend *ioend) in xfs_setfilesize_trans_alloc() argument
132 struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; in xfs_setfilesize_trans_alloc()
140 ioend->io_append_trans = tp; in xfs_setfilesize_trans_alloc()
146 __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS); in xfs_setfilesize_trans_alloc()
203 struct xfs_ioend *ioend, in xfs_setfilesize_ioend() argument
206 struct xfs_inode *ip = XFS_I(ioend->io_inode); in xfs_setfilesize_ioend()
207 struct xfs_trans *tp = ioend->io_append_trans; in xfs_setfilesize_ioend()
223 return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); in xfs_setfilesize_ioend()
231 struct xfs_ioend *ioend) in xfs_end_ioend() argument
234 struct xfs_inode *ip = XFS_I(ioend->io_inode); in xfs_end_ioend()
235 xfs_off_t offset = ioend->io_offset; in xfs_end_ioend()
236 size_t size = ioend->io_size; in xfs_end_ioend()
258 error = blk_status_to_errno(ioend->io_bio->bi_status); in xfs_end_ioend()
260 if (ioend->io_fork == XFS_COW_FORK) in xfs_end_ioend()
268 if (ioend->io_fork == XFS_COW_FORK) in xfs_end_ioend()
270 else if (ioend->io_state == XFS_EXT_UNWRITTEN) in xfs_end_ioend()
273 ASSERT(!xfs_ioend_is_append(ioend) || ioend->io_append_trans); in xfs_end_ioend()
276 if (ioend->io_append_trans) in xfs_end_ioend()
277 error = xfs_setfilesize_ioend(ioend, error); in xfs_end_ioend()
278 list_replace_init(&ioend->io_list, &ioend_list); in xfs_end_ioend()
279 xfs_destroy_ioend(ioend, error); in xfs_end_ioend()
282 ioend = list_first_entry(&ioend_list, struct xfs_ioend, in xfs_end_ioend()
284 list_del_init(&ioend->io_list); in xfs_end_ioend()
285 xfs_destroy_ioend(ioend, error); in xfs_end_ioend()
296 struct xfs_ioend *ioend, in xfs_ioend_can_merge() argument
299 if (ioend->io_bio->bi_status != next->io_bio->bi_status) in xfs_ioend_can_merge()
301 if ((ioend->io_fork == XFS_COW_FORK) ^ (next->io_fork == XFS_COW_FORK)) in xfs_ioend_can_merge()
303 if ((ioend->io_state == XFS_EXT_UNWRITTEN) ^ in xfs_ioend_can_merge()
306 if (ioend->io_offset + ioend->io_size != next->io_offset) in xfs_ioend_can_merge()
319 struct xfs_ioend *ioend, in xfs_ioend_merge_append_transactions() argument
322 if (!ioend->io_append_trans) { in xfs_ioend_merge_append_transactions()
323 ioend->io_append_trans = next->io_append_trans; in xfs_ioend_merge_append_transactions()
333 struct xfs_ioend *ioend, in xfs_ioend_try_merge() argument
341 if (!xfs_ioend_can_merge(ioend, next_ioend)) in xfs_ioend_try_merge()
343 list_move_tail(&next_ioend->io_list, &ioend->io_list); in xfs_ioend_try_merge()
344 ioend->io_size += next_ioend->io_size; in xfs_ioend_try_merge()
346 xfs_ioend_merge_append_transactions(ioend, next_ioend); in xfs_ioend_try_merge()
375 struct xfs_ioend *ioend; in xfs_end_io() local
388 ioend = list_first_entry(&completion_list, struct xfs_ioend, in xfs_end_io()
390 list_del_init(&ioend->io_list); in xfs_end_io()
391 xfs_ioend_try_merge(ioend, &completion_list); in xfs_end_io()
392 xfs_end_ioend(ioend); in xfs_end_io()
400 struct xfs_ioend *ioend = bio->bi_private; in xfs_end_bio() local
401 struct xfs_inode *ip = XFS_I(ioend->io_inode); in xfs_end_bio()
405 if (ioend->io_fork == XFS_COW_FORK || in xfs_end_bio()
406 ioend->io_state == XFS_EXT_UNWRITTEN || in xfs_end_bio()
407 ioend->io_append_trans != NULL) { in xfs_end_bio()
412 list_add_tail(&ioend->io_list, &ip->i_ioend_list); in xfs_end_bio()
415 xfs_destroy_ioend(ioend, blk_status_to_errno(bio->bi_status)); in xfs_end_bio()
646 struct xfs_ioend *ioend, in xfs_submit_ioend() argument
659 if (!status && ioend->io_fork == XFS_COW_FORK) { in xfs_submit_ioend()
660 status = xfs_reflink_convert_cow(XFS_I(ioend->io_inode), in xfs_submit_ioend()
661 ioend->io_offset, ioend->io_size); in xfs_submit_ioend()
666 (ioend->io_fork == XFS_COW_FORK || in xfs_submit_ioend()
667 ioend->io_state != XFS_EXT_UNWRITTEN) && in xfs_submit_ioend()
668 xfs_ioend_is_append(ioend) && in xfs_submit_ioend()
669 !ioend->io_append_trans) in xfs_submit_ioend()
670 status = xfs_setfilesize_trans_alloc(ioend); in xfs_submit_ioend()
674 ioend->io_bio->bi_private = ioend; in xfs_submit_ioend()
675 ioend->io_bio->bi_end_io = xfs_end_bio; in xfs_submit_ioend()
684 ioend->io_bio->bi_status = errno_to_blk_status(status); in xfs_submit_ioend()
685 bio_endio(ioend->io_bio); in xfs_submit_ioend()
689 submit_bio(ioend->io_bio); in xfs_submit_ioend()
703 struct xfs_ioend *ioend; in xfs_alloc_ioend() local
713 ioend = container_of(bio, struct xfs_ioend, io_inline_bio); in xfs_alloc_ioend()
714 INIT_LIST_HEAD(&ioend->io_list); in xfs_alloc_ioend()
715 ioend->io_fork = fork; in xfs_alloc_ioend()
716 ioend->io_state = state; in xfs_alloc_ioend()
717 ioend->io_inode = inode; in xfs_alloc_ioend()
718 ioend->io_size = 0; in xfs_alloc_ioend()
719 ioend->io_offset = offset; in xfs_alloc_ioend()
720 ioend->io_append_trans = NULL; in xfs_alloc_ioend()
721 ioend->io_bio = bio; in xfs_alloc_ioend()
722 return ioend; in xfs_alloc_ioend()
775 if (!wpc->ioend || in xfs_add_to_ioend()
776 wpc->fork != wpc->ioend->io_fork || in xfs_add_to_ioend()
777 wpc->imap.br_state != wpc->ioend->io_state || in xfs_add_to_ioend()
778 sector != bio_end_sector(wpc->ioend->io_bio) || in xfs_add_to_ioend()
779 offset != wpc->ioend->io_offset + wpc->ioend->io_size) { in xfs_add_to_ioend()
780 if (wpc->ioend) in xfs_add_to_ioend()
781 list_add(&wpc->ioend->io_list, iolist); in xfs_add_to_ioend()
782 wpc->ioend = xfs_alloc_ioend(inode, wpc->fork, in xfs_add_to_ioend()
786 merged = __bio_try_merge_page(wpc->ioend->io_bio, page, len, poff, in xfs_add_to_ioend()
793 if (bio_full(wpc->ioend->io_bio, len)) in xfs_add_to_ioend()
794 wpc->ioend->io_bio = xfs_chain_bio(wpc->ioend->io_bio); in xfs_add_to_ioend()
795 bio_add_page(wpc->ioend->io_bio, page, len, poff); in xfs_add_to_ioend()
798 wpc->ioend->io_size += len; in xfs_add_to_ioend()
876 struct xfs_ioend *ioend, *next; in xfs_writepage_map() local
904 ASSERT(wpc->ioend || list_empty(&submit_list)); in xfs_writepage_map()
951 list_for_each_entry_safe(ioend, next, &submit_list, io_list) { in xfs_writepage_map()
954 list_del_init(&ioend->io_list); in xfs_writepage_map()
955 error2 = xfs_submit_ioend(wbc, ioend, error); in xfs_writepage_map()
1096 if (wpc.ioend) in xfs_vm_writepage()
1097 ret = xfs_submit_ioend(wbc, wpc.ioend, ret); in xfs_vm_writepage()
1111 if (wpc.ioend) in xfs_vm_writepages()
1112 ret = xfs_submit_ioend(wbc, wpc.ioend, ret); in xfs_vm_writepages()