Merge tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper...
[cascardo/linux.git] / fs / fat / inode.c
index d1a26c2..c067746 100644 (file)
@@ -237,8 +237,7 @@ static int fat_write_end(struct file *file, struct address_space *mapping,
        return err;
 }
 
-static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
-                            struct iov_iter *iter,
+static ssize_t fat_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
                             loff_t offset)
 {
        struct file *file = iocb->ki_filp;
@@ -247,7 +246,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       if (rw == WRITE) {
+       if (iov_iter_rw(iter) == WRITE) {
                /*
                 * FIXME: blockdev_direct_IO() doesn't use ->write_begin(),
                 * so we need to update the ->mmu_private to block boundary.
@@ -266,8 +265,8 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
         * FAT need to use the DIO_LOCKING for avoiding the race
         * condition of fat_get_block() and ->truncate().
         */
-       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, fat_get_block);
-       if (ret < 0 && (rw & WRITE))
+       ret = blockdev_direct_IO(iocb, inode, iter, offset, fat_get_block);
+       if (ret < 0 && iov_iter_rw(iter) == WRITE)
                fat_write_failed(mapping, offset + count);
 
        return ret;