diff --git a/exfat_super.c b/exfat_super.c index c35f005..7fc574a 100644 --- a/exfat_super.c +++ b/exfat_super.c @@ -1577,9 +1577,14 @@ static int exfat_write_end(struct file *file, struct address_space *mapping, } #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) +#ifdef CONFIG_AIO_OPTIMIZATION +static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, + struct iov_iter *iter, loff_t offset) +#else static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) +#endif #else static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t offset) @@ -1593,7 +1598,12 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, if (rw == WRITE) { #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) +#ifdef CONFIG_AIO_OPTIMIZATION + if (EXFAT_I(inode)->mmu_private < + (offset + iov_iter_count(iter))) +#else if (EXFAT_I(inode)->mmu_private < (offset + iov_length(iov, nr_segs))) +#endif #else if (EXFAT_I(inode)->mmu_private < (offset + iov_iter_count(iter))) #endif @@ -1603,8 +1613,13 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, exfat_get_block); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) +#ifdef CONFIG_AIO_OPTIMIZATION + ret = blockdev_direct_IO(rw, iocb, inode, iter, + offset, exfat_get_block); +#else ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, exfat_get_block); +#endif #else ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, exfat_get_block, NULL); @@ -1615,7 +1630,11 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, exfat_write_failed(mapping, offset+iov_iter_count(iter)); #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) if ((ret < 0) && (rw & WRITE)) +#ifdef CONFIG_AIO_OPTIMIZATION + exfat_write_failed(mapping, offset+iov_iter_count(iter)); +#else exfat_write_failed(mapping, offset+iov_length(iov, nr_segs)); +#endif #endif return ret; } @@ -1867,7 +1886,7 @@ static void exfat_evict_inode(struct inode *inode) if (!inode->i_nlink) i_size_write(inode, 0); invalidate_inode_buffers(inode); -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,80) end_writeback(inode); #else clear_inode(inode);