diff options
author | Omar Sandoval <osandov@osandov.com> | 2015-03-16 07:33:52 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:29:45 -0400 |
commit | 6f67376318abea58589ebe6d69dffeabb6f6c26a (patch) | |
tree | 1d3e6b00735aed811dcaeee2ccf7fa65eebc406d /fs/f2fs/data.c | |
parent | a95cd6311512bd954e88684eb39373f7f4b0a984 (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/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e16adebcb9b6..ce25f62edfa7 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -1118,12 +1118,12 @@ static int f2fs_write_end(struct file *file, | |||
1118 | return copied; | 1118 | return copied; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static int check_direct_IO(struct inode *inode, int rw, | 1121 | static int check_direct_IO(struct inode *inode, struct iov_iter *iter, |
1122 | struct iov_iter *iter, loff_t offset) | 1122 | loff_t offset) |
1123 | { | 1123 | { |
1124 | unsigned blocksize_mask = inode->i_sb->s_blocksize - 1; | 1124 | unsigned blocksize_mask = inode->i_sb->s_blocksize - 1; |
1125 | 1125 | ||
1126 | if (rw == READ) | 1126 | if (iov_iter_rw(iter) == READ) |
1127 | return 0; | 1127 | return 0; |
1128 | 1128 | ||
1129 | if (offset & blocksize_mask) | 1129 | if (offset & blocksize_mask) |
@@ -1151,19 +1151,19 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb, | |||
1151 | return err; | 1151 | return err; |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | if (check_direct_IO(inode, rw, iter, offset)) | 1154 | if (check_direct_IO(inode, iter, offset)) |
1155 | return 0; | 1155 | return 0; |
1156 | 1156 | ||
1157 | trace_f2fs_direct_IO_enter(inode, offset, count, rw); | 1157 | trace_f2fs_direct_IO_enter(inode, offset, count, iov_iter_rw(iter)); |
1158 | 1158 | ||
1159 | if (rw & WRITE) | 1159 | if (iov_iter_rw(iter) == WRITE) |
1160 | __allocate_data_blocks(inode, offset, count); | 1160 | __allocate_data_blocks(inode, offset, count); |
1161 | 1161 | ||
1162 | err = blockdev_direct_IO(iocb, inode, iter, offset, get_data_block); | 1162 | err = blockdev_direct_IO(iocb, inode, iter, offset, get_data_block); |
1163 | if (err < 0 && (rw & WRITE)) | 1163 | if (err < 0 && iov_iter_rw(iter) == WRITE) |
1164 | f2fs_write_failed(mapping, offset + count); | 1164 | f2fs_write_failed(mapping, offset + count); |
1165 | 1165 | ||
1166 | trace_f2fs_direct_IO_exit(inode, offset, count, rw, err); | 1166 | trace_f2fs_direct_IO_exit(inode, offset, count, iov_iter_rw(iter), err); |
1167 | 1167 | ||
1168 | return err; | 1168 | return err; |
1169 | } | 1169 | } |