Lines Matching refs:ioend

79 	xfs_ioend_t		*ioend)  in xfs_destroy_ioend()  argument
83 for (bh = ioend->io_buffer_head; bh; bh = next) { in xfs_destroy_ioend()
85 bh->b_end_io(bh, !ioend->io_error); in xfs_destroy_ioend()
88 mempool_free(ioend, xfs_ioend_pool); in xfs_destroy_ioend()
94 static inline bool xfs_ioend_is_append(struct xfs_ioend *ioend) in xfs_ioend_is_append() argument
96 return ioend->io_offset + ioend->io_size > in xfs_ioend_is_append()
97 XFS_I(ioend->io_inode)->i_d.di_size; in xfs_ioend_is_append()
102 struct xfs_ioend *ioend) in xfs_setfilesize_trans_alloc() argument
104 struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; in xfs_setfilesize_trans_alloc()
116 ioend->io_append_trans = tp; in xfs_setfilesize_trans_alloc()
122 __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS); in xfs_setfilesize_trans_alloc()
162 struct xfs_ioend *ioend) in xfs_setfilesize_ioend() argument
164 struct xfs_inode *ip = XFS_I(ioend->io_inode); in xfs_setfilesize_ioend()
165 struct xfs_trans *tp = ioend->io_append_trans; in xfs_setfilesize_ioend()
176 if (ioend->io_error) { in xfs_setfilesize_ioend()
178 return ioend->io_error; in xfs_setfilesize_ioend()
181 return xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); in xfs_setfilesize_ioend()
192 struct xfs_ioend *ioend) in xfs_finish_ioend() argument
194 if (atomic_dec_and_test(&ioend->io_remaining)) { in xfs_finish_ioend()
195 struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; in xfs_finish_ioend()
197 if (ioend->io_type == XFS_IO_UNWRITTEN) in xfs_finish_ioend()
198 queue_work(mp->m_unwritten_workqueue, &ioend->io_work); in xfs_finish_ioend()
199 else if (ioend->io_append_trans) in xfs_finish_ioend()
200 queue_work(mp->m_data_workqueue, &ioend->io_work); in xfs_finish_ioend()
202 xfs_destroy_ioend(ioend); in xfs_finish_ioend()
213 xfs_ioend_t *ioend = container_of(work, xfs_ioend_t, io_work); in xfs_end_io() local
214 struct xfs_inode *ip = XFS_I(ioend->io_inode); in xfs_end_io()
218 ioend->io_error = -EIO; in xfs_end_io()
229 if (ioend->io_type == XFS_IO_UNWRITTEN) { in xfs_end_io()
230 if (ioend->io_error) in xfs_end_io()
232 error = xfs_iomap_write_unwritten(ip, ioend->io_offset, in xfs_end_io()
233 ioend->io_size); in xfs_end_io()
234 } else if (ioend->io_append_trans) { in xfs_end_io()
235 error = xfs_setfilesize_ioend(ioend); in xfs_end_io()
237 ASSERT(!xfs_ioend_is_append(ioend)); in xfs_end_io()
242 ioend->io_error = error; in xfs_end_io()
243 xfs_destroy_ioend(ioend); in xfs_end_io()
257 xfs_ioend_t *ioend; in xfs_alloc_ioend() local
259 ioend = mempool_alloc(xfs_ioend_pool, GFP_NOFS); in xfs_alloc_ioend()
266 atomic_set(&ioend->io_remaining, 1); in xfs_alloc_ioend()
267 ioend->io_error = 0; in xfs_alloc_ioend()
268 ioend->io_list = NULL; in xfs_alloc_ioend()
269 ioend->io_type = type; in xfs_alloc_ioend()
270 ioend->io_inode = inode; in xfs_alloc_ioend()
271 ioend->io_buffer_head = NULL; in xfs_alloc_ioend()
272 ioend->io_buffer_tail = NULL; in xfs_alloc_ioend()
273 ioend->io_offset = 0; in xfs_alloc_ioend()
274 ioend->io_size = 0; in xfs_alloc_ioend()
275 ioend->io_append_trans = NULL; in xfs_alloc_ioend()
277 INIT_WORK(&ioend->io_work, xfs_end_io); in xfs_alloc_ioend()
278 return ioend; in xfs_alloc_ioend()
363 xfs_ioend_t *ioend = bio->bi_private; in xfs_end_bio() local
365 if (!ioend->io_error) in xfs_end_bio()
366 ioend->io_error = bio->bi_error; in xfs_end_bio()
373 xfs_finish_ioend(ioend); in xfs_end_bio()
379 xfs_ioend_t *ioend, in xfs_submit_ioend_bio() argument
382 atomic_inc(&ioend->io_remaining); in xfs_submit_ioend_bio()
383 bio->bi_private = ioend; in xfs_submit_ioend_bio()
473 xfs_ioend_t *ioend, in xfs_submit_ioend() argument
476 xfs_ioend_t *head = ioend; in xfs_submit_ioend()
484 next = ioend->io_list; in xfs_submit_ioend()
485 for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) in xfs_submit_ioend()
487 } while ((ioend = next) != NULL); in xfs_submit_ioend()
490 ioend = head; in xfs_submit_ioend()
492 next = ioend->io_list; in xfs_submit_ioend()
502 ioend->io_error = fail; in xfs_submit_ioend()
503 xfs_finish_ioend(ioend); in xfs_submit_ioend()
507 for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) { in xfs_submit_ioend()
513 xfs_submit_ioend_bio(wbc, ioend, bio); in xfs_submit_ioend()
518 xfs_submit_ioend_bio(wbc, ioend, bio); in xfs_submit_ioend()
525 xfs_submit_ioend_bio(wbc, ioend, bio); in xfs_submit_ioend()
526 xfs_finish_ioend(ioend); in xfs_submit_ioend()
527 } while ((ioend = next) != NULL); in xfs_submit_ioend()
537 xfs_ioend_t *ioend) in xfs_cancel_ioend() argument
543 next = ioend->io_list; in xfs_cancel_ioend()
544 bh = ioend->io_buffer_head; in xfs_cancel_ioend()
553 if (ioend->io_type == XFS_IO_UNWRITTEN) in xfs_cancel_ioend()
558 mempool_free(ioend, xfs_ioend_pool); in xfs_cancel_ioend()
559 } while ((ioend = next) != NULL); in xfs_cancel_ioend()
577 xfs_ioend_t *ioend = *result; in xfs_add_to_ioend() local
579 if (!ioend || need_ioend || type != ioend->io_type) { in xfs_add_to_ioend()
582 ioend = xfs_alloc_ioend(inode, type); in xfs_add_to_ioend()
583 ioend->io_offset = offset; in xfs_add_to_ioend()
584 ioend->io_buffer_head = bh; in xfs_add_to_ioend()
585 ioend->io_buffer_tail = bh; in xfs_add_to_ioend()
587 previous->io_list = ioend; in xfs_add_to_ioend()
588 *result = ioend; in xfs_add_to_ioend()
590 ioend->io_buffer_tail->b_private = bh; in xfs_add_to_ioend()
591 ioend->io_buffer_tail = bh; in xfs_add_to_ioend()
595 ioend->io_size += bh->b_size; in xfs_add_to_ioend()
950 xfs_ioend_t *ioend = NULL, *iohead = NULL; in xfs_vm_writepage() local
1130 xfs_add_to_ioend(inode, bh, offset, type, &ioend, in xfs_vm_writepage()
1136 iohead = ioend; in xfs_vm_writepage()
1146 if (!ioend) in xfs_vm_writepage()
1171 xfs_cluster_write(inode, page->index + 1, &imap, &ioend, in xfs_vm_writepage()
1180 if (ioend->io_type != XFS_IO_UNWRITTEN && xfs_ioend_is_append(ioend)) in xfs_vm_writepage()
1181 err = xfs_setfilesize_trans_alloc(ioend); in xfs_vm_writepage()
1285 struct xfs_ioend *ioend; in xfs_map_direct() local
1304 ioend = bh_result->b_private; in xfs_map_direct()
1305 ASSERT(ioend->io_size > 0); in xfs_map_direct()
1306 ASSERT(offset >= ioend->io_offset); in xfs_map_direct()
1307 if (offset + size > ioend->io_offset + ioend->io_size) in xfs_map_direct()
1308 ioend->io_size = offset - ioend->io_offset + size; in xfs_map_direct()
1310 if (type == XFS_IO_UNWRITTEN && type != ioend->io_type) in xfs_map_direct()
1311 ioend->io_type = XFS_IO_UNWRITTEN; in xfs_map_direct()
1313 trace_xfs_gbmap_direct_update(XFS_I(inode), ioend->io_offset, in xfs_map_direct()
1314 ioend->io_size, ioend->io_type, in xfs_map_direct()
1319 ioend = xfs_alloc_ioend(inode, type); in xfs_map_direct()
1320 ioend->io_offset = offset; in xfs_map_direct()
1321 ioend->io_size = size; in xfs_map_direct()
1323 bh_result->b_private = ioend; in xfs_map_direct()
1576 struct xfs_ioend *ioend, in __xfs_end_io_direct_write() argument
1582 if (XFS_FORCED_SHUTDOWN(mp) || ioend->io_error) in __xfs_end_io_direct_write()
1599 ASSERT(offset + size <= ioend->io_offset + ioend->io_size); in __xfs_end_io_direct_write()
1600 ioend->io_size = size; in __xfs_end_io_direct_write()
1601 ioend->io_offset = offset; in __xfs_end_io_direct_write()
1631 if (ioend->io_type == XFS_IO_OVERWRITE) in __xfs_end_io_direct_write()
1632 ioend->io_error = xfs_setfilesize_trans_alloc(ioend); in __xfs_end_io_direct_write()
1635 xfs_end_io(&ioend->io_work); in __xfs_end_io_direct_write()
1656 struct xfs_ioend *ioend = private; in xfs_end_io_direct_write() local
1659 ioend ? ioend->io_type : 0, NULL); in xfs_end_io_direct_write()
1661 if (!ioend) { in xfs_end_io_direct_write()
1666 __xfs_end_io_direct_write(inode, ioend, offset, size); in xfs_end_io_direct_write()