aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-03-16 07:33:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:29:45 -0400
commit6f67376318abea58589ebe6d69dffeabb6f6c26a (patch)
tree1d3e6b00735aed811dcaeee2ccf7fa65eebc406d /fs/gfs2
parenta95cd6311512bd954e88684eb39373f7f4b0a984 (diff)
direct_IO: use iov_iter_rw() instead of rw everywhere
The rw parameter to direct_IO is redundant with iov_iter->type, and treated slightly differently just about everywhere it's used: some users do rw & WRITE, and others do rw == WRITE where they should be doing a bitwise check. Simplify this with the new iov_iter_rw() helper, which always returns either READ or WRITE. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/aops.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 59983a18cab4..e22e6e686a11 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1016,13 +1016,12 @@ out:
1016/** 1016/**
1017 * gfs2_ok_for_dio - check that dio is valid on this file 1017 * gfs2_ok_for_dio - check that dio is valid on this file
1018 * @ip: The inode 1018 * @ip: The inode
1019 * @rw: READ or WRITE
1020 * @offset: The offset at which we are reading or writing 1019 * @offset: The offset at which we are reading or writing
1021 * 1020 *
1022 * Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o) 1021 * Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o)
1023 * 1 (to accept the i/o request) 1022 * 1 (to accept the i/o request)
1024 */ 1023 */
1025static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset) 1024static int gfs2_ok_for_dio(struct gfs2_inode *ip, loff_t offset)
1026{ 1025{
1027 /* 1026 /*
1028 * Should we return an error here? I can't see that O_DIRECT for 1027 * Should we return an error here? I can't see that O_DIRECT for
@@ -1061,7 +1060,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
1061 rv = gfs2_glock_nq(&gh); 1060 rv = gfs2_glock_nq(&gh);
1062 if (rv) 1061 if (rv)
1063 return rv; 1062 return rv;
1064 rv = gfs2_ok_for_dio(ip, rw, offset); 1063 rv = gfs2_ok_for_dio(ip, offset);
1065 if (rv != 1) 1064 if (rv != 1)
1066 goto out; /* dio not valid, fall back to buffered i/o */ 1065 goto out; /* dio not valid, fall back to buffered i/o */
1067 1066
@@ -1091,7 +1090,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
1091 rv = filemap_write_and_wait_range(mapping, lstart, end); 1090 rv = filemap_write_and_wait_range(mapping, lstart, end);
1092 if (rv) 1091 if (rv)
1093 goto out; 1092 goto out;
1094 if (rw == WRITE) 1093 if (iov_iter_rw(iter) == WRITE)
1095 truncate_inode_pages_range(mapping, lstart, end); 1094 truncate_inode_pages_range(mapping, lstart, end);
1096 } 1095 }
1097 1096