Merge tag 'gfs2-merge-window' of git://git.kernel.org:/pub/scm/linux/kernel/git/gfs2...
[firefly-linux-kernel-4.4.55.git] / fs / gfs2 / aops.c
index 7c5a96c0b9f10cb05810a9cc13fdc04f219b91a3..1caee05345878d38591a3d000466ecd3d147e937 100644 (file)
@@ -1020,13 +1020,12 @@ out:
 /**
  * gfs2_ok_for_dio - check that dio is valid on this file
  * @ip: The inode
- * @rw: READ or WRITE
  * @offset: The offset at which we are reading or writing
  *
  * Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o)
  *          1 (to accept the i/o request)
  */
-static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset)
+static int gfs2_ok_for_dio(struct gfs2_inode *ip, loff_t offset)
 {
        /*
         * Should we return an error here? I can't see that O_DIRECT for
@@ -1043,8 +1042,8 @@ static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset)
 
 
 
-static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
-                             struct iov_iter *iter, loff_t offset)
+static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
+                             loff_t offset)
 {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
@@ -1065,7 +1064,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
        rv = gfs2_glock_nq(&gh);
        if (rv)
                return rv;
-       rv = gfs2_ok_for_dio(ip, rw, offset);
+       rv = gfs2_ok_for_dio(ip, offset);
        if (rv != 1)
                goto out; /* dio not valid, fall back to buffered i/o */
 
@@ -1095,13 +1094,12 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
                rv = filemap_write_and_wait_range(mapping, lstart, end);
                if (rv)
                        goto out;
-               if (rw == WRITE)
+               if (iov_iter_rw(iter) == WRITE)
                        truncate_inode_pages_range(mapping, lstart, end);
        }
 
-       rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                 iter, offset,
-                                 gfs2_get_block_direct, NULL, NULL, 0);
+       rv = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
+                                 offset, gfs2_get_block_direct, NULL, NULL, 0);
 out:
        gfs2_glock_dq(&gh);
        gfs2_holder_uninit(&gh);