/* It lets the filesystem know if it registered an interest earlier via get_block. Pass the private field of the map buffer_head so that filesystems can use it to hold additional state between get_block calls and dio_complete.  */
static int dio_complete(struct dio *dio, loff_t offset, int ret)
/* It lets the filesystem know if it registered an interest earlier via get_block. Pass the private field of the map buffer_head so that filesystems can use it to hold additional state between get_block calls and dio_complete.  */
static int dio_complete(struct dio *dio, loff_t offset, int ret)
{
	ssize_t transferred = 0;
	if (ret == -EIOCBQUEUED)
		ret = 0;
	if (dio->result) {
		transferred = dio->result;
		if ((dio->rw == READ) && ((offset + transferred) > dio->i_size))
			transferred = dio->i_size - offset;
	}
	if (dio->end_io && dio->result)
		dio->end_io(dio->iocb, offset, transferred,
			    dio->map_bh.b_private);
	if (dio->flags & DIO_LOCKING)
		up_read_non_owner(&dio->inode->i_alloc_sem);
	if (ret == 0)
		ret = dio->page_errors;
	if (ret == 0)
		ret = dio->io_error;
	if (ret == 0)
		ret = transferred;
	return ret;
}