summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-03-16 04:33:52 -0700
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:29:45 -0400
commit6f67376318abea58589ebe6d69dffeabb6f6c26a (patch)
tree1d3e6b00735aed811dcaeee2ccf7fa65eebc406d /fs/fuse
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/fuse')
-rw-r--r--fs/fuse/file.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index e1afdd7abf90..c1a67da6a8a0 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2800,11 +2800,11 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
inode = file->f_mapping->host;
i_size = i_size_read(inode);
- if ((rw == READ) && (offset > i_size))
+ if ((iov_iter_rw(iter) == READ) && (offset > i_size))
return 0;
/* optimization for short read */
- if (async_dio && rw != WRITE && offset + count > i_size) {
+ if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) {
if (offset >= i_size)
return 0;
count = min_t(loff_t, count, fuse_round_up(i_size - offset));
@@ -2819,7 +2819,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
io->bytes = -1;
io->size = 0;
io->offset = offset;
- io->write = (rw == WRITE);
+ io->write = (iov_iter_rw(iter) == WRITE);
io->err = 0;
io->file = file;
/*
@@ -2834,13 +2834,14 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
* to wait on real async I/O requests, so we must submit this request
* synchronously.
*/
- if (!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE)
+ if (!is_sync_kiocb(iocb) && (offset + count > i_size) &&
+ iov_iter_rw(iter) == WRITE)
io->async = false;
if (io->async && is_sync_kiocb(iocb))
io->done = &wait;
- if (rw == WRITE) {
+ if (iov_iter_rw(iter) == WRITE) {
ret = generic_write_checks(file, &pos, &count, 0);
if (!ret) {
iov_iter_truncate(iter, count);
@@ -2865,7 +2866,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
kfree(io);
- if (rw == WRITE) {
+ if (iov_iter_rw(iter) == WRITE) {
if (ret > 0)
fuse_write_update_size(inode, pos);
else if (ret < 0 && offset + count > i_size)