diff --git a/exfat_super.c b/exfat_super.c index 8bca561..813304f 100644 --- a/exfat_super.c +++ b/exfat_super.c @@ -1324,10 +1324,17 @@ static int exfat_file_release(struct inode *inode, struct file *filp) const struct file_operations exfat_file_operations = { .llseek = generic_file_llseek, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) .read = do_sync_read, .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, +#else + .read = new_sync_read, + .write = new_sync_write, + .read_iter = generic_file_read_iter, + .write_iter = generic_file_write_iter, +#endif .mmap = generic_file_mmap, .release = exfat_file_release, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) @@ -1566,9 +1573,14 @@ static int exfat_write_end(struct file *file, struct address_space *mapping, return err; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) +#else +static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, + struct iov_iter *iter, loff_t offset) +#endif { struct inode *inode = iocb->ki_filp->f_mapping->host; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) @@ -1577,10 +1589,17 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, ssize_t ret; if (rw == WRITE) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) if (EXFAT_I(inode)->mmu_private < (offset + iov_length(iov, nr_segs))) +#else + if (EXFAT_I(inode)->mmu_private < (offset + iov_iter_count(iter))) +#endif return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) + ret = blockdev_direct_IO(rw, iocb, inode, iter, + offset, exfat_get_block); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, exfat_get_block); #else @@ -1588,7 +1607,10 @@ static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb, offset, nr_segs, exfat_get_block, NULL); #endif -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) + if ((ret < 0) && (rw & WRITE)) + exfat_write_failed(mapping, offset+iov_iter_count(iter)); +#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) if ((ret < 0) && (rw & WRITE)) exfat_write_failed(mapping, offset+iov_length(iov, nr_segs)); #endif