/* We're now finished for good with this ioend structure. Update the page state via the associated buffer_heads, release holds on the inode and bio, and finally free up memory. Do not use the ioend after this.  */
STATIC void xfs_destroy_ioend(xfs_ioend_t *ioend)
/* We're now finished for good with this ioend structure. Update the page state via the associated buffer_heads, release holds on the inode and bio, and finally free up memory. Do not use the ioend after this.  */
STATIC void xfs_destroy_ioend(xfs_ioend_t *ioend)
{
	struct buffer_head	*bh, *next;
	struct xfs_inode	*ip = XFS_I(ioend->io_inode);
	for (bh = ioend->io_buffer_head; bh; bh = next) {
		next = bh->b_private;
		bh->b_end_io(bh, !ioend->io_error);
	}
	if (unlikely(ioend->io_error == -ENODEV)) {
		xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ,
				      __FILE__, __LINE__);
	}
	xfs_ioend_wake(ip);
	mempool_free(ioend, xfs_ioend_pool);
}