Skip to content

Commit

Permalink
Add define for CONFIG_AIO_OPTIMIZATION that we use in many kernels.
Browse files Browse the repository at this point in the history
It's needs the 3.16.y functions defines.
  • Loading branch information
Dorimanx committed Oct 15, 2014
1 parent 3c73004 commit a862d50
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion exfat_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a862d50

Please sign in to comment.