/* When AIO DIO IO is completed, the work to convert unwritten extents to written is queued on workqueue but may not get immediately scheduled. When fsync is called, we need to ensure the conversion is complete before fsync returns. The inode keeps track of a list of completed AIO from DIO path that might needs to do the conversion. This function walks through the list and convert the related unwritten extents to written.  */
int flush_aio_dio_completed_IO(struct inode *inode)
/* When AIO DIO IO is completed, the work to convert unwritten extents to written is queued on workqueue but may not get immediately scheduled. When fsync is called, we need to ensure the conversion is complete before fsync returns. The inode keeps track of a list of completed AIO from DIO path that might needs to do the conversion. This function walks through the list and convert the related unwritten extents to written.  */
int flush_aio_dio_completed_IO(struct inode *inode)
{
	ext4_io_end_t *io;
	int ret = 0;
	int ret2 = 0;
	if (list_empty(&EXT4_I(inode)->i_aio_dio_complete_list))
		return ret;
	dump_aio_dio_list(inode);
	while (!list_empty(&EXT4_I(inode)->i_aio_dio_complete_list)){
		io = list_entry(EXT4_I(inode)->i_aio_dio_complete_list.next,
				ext4_io_end_t, list);
		ret = ext4_end_aio_dio_nolock(io);
		if (ret < 0)
			ret2 = ret;
		else
			list_del_init(&io->list);
	}
	return (ret2 < 0) ? ret2 : 0;
}