/* Allocate and initialise an IO completion structure. We need to track unwritten extent write completion here initially. We'll need to extend this for updating the ondisk inode size later (vs. incore size).  */
STATIC xfs_ioend_t* xfs_alloc_ioend(struct inode *inode, unsigned int type)
/* Allocate and initialise an IO completion structure. We need to track unwritten extent write completion here initially. We'll need to extend this for updating the ondisk inode size later (vs. incore size).  */
STATIC xfs_ioend_t* xfs_alloc_ioend(struct inode *inode, unsigned int type)
{
	xfs_ioend_t		*ioend;
	ioend = mempool_alloc(xfs_ioend_pool, GFP_NOFS);
	atomic_set(&ioend->io_remaining, 1);
	ioend->io_error = 0;
	ioend->io_list = NULL;
	ioend->io_type = type;
	ioend->io_inode = inode;
	ioend->io_buffer_head = NULL;
	ioend->io_buffer_tail = NULL;
	atomic_inc(&XFS_I(ioend->io_inode)->i_iocount);
	ioend->io_offset = 0;
	ioend->io_size = 0;
	INIT_WORK(&ioend->io_work, xfs_end_io);
	return ioend;
}