/* Cancel submission of all buffer_heads so far in this endio. Toss the endio too. Only ever called for the initial page in a writepage request, so only ever one page.  */
STATIC void xfs_cancel_ioend(xfs_ioend_t *ioend)
/* Cancel submission of all buffer_heads so far in this endio. Toss the endio too. Only ever called for the initial page in a writepage request, so only ever one page.  */
STATIC void xfs_cancel_ioend(xfs_ioend_t *ioend)
{
	xfs_ioend_t		*next;
	struct buffer_head	*bh, *next_bh;
	do {
		next = ioend->io_list;
		bh = ioend->io_buffer_head;
		do {
			next_bh = bh->b_private;
			clear_buffer_async_write(bh);
			unlock_buffer(bh);
		} while ((bh = next_bh) != NULL);
		xfs_ioend_wake(XFS_I(ioend->io_inode));
		mempool_free(ioend, xfs_ioend_pool);
	} while ((ioend = next) != NULL);
}