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/ext4/indirect.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/ext4/indirect.c')
-rw-r--r-- | fs/ext4/indirect.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index cd81d01da0b0..3580629e42d3 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -642,8 +642,8 @@ out: | |||
642 | * crashes then stale disk data _may_ be exposed inside the file. But current | 642 | * crashes then stale disk data _may_ be exposed inside the file. But current |
643 | * VFS code falls back into buffered path in that case so we are safe. | 643 | * VFS code falls back into buffered path in that case so we are safe. |
644 | */ | 644 | */ |
645 | ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb, | 645 | ssize_t ext4_ind_direct_IO(struct kiocb *iocb, struct iov_iter *iter, |
646 | struct iov_iter *iter, loff_t offset) | 646 | loff_t offset) |
647 | { | 647 | { |
648 | struct file *file = iocb->ki_filp; | 648 | struct file *file = iocb->ki_filp; |
649 | struct inode *inode = file->f_mapping->host; | 649 | struct inode *inode = file->f_mapping->host; |
@@ -654,7 +654,7 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb, | |||
654 | size_t count = iov_iter_count(iter); | 654 | size_t count = iov_iter_count(iter); |
655 | int retries = 0; | 655 | int retries = 0; |
656 | 656 | ||
657 | if (rw == WRITE) { | 657 | if (iov_iter_rw(iter) == WRITE) { |
658 | loff_t final_size = offset + count; | 658 | loff_t final_size = offset + count; |
659 | 659 | ||
660 | if (final_size > inode->i_size) { | 660 | if (final_size > inode->i_size) { |
@@ -676,7 +676,7 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb, | |||
676 | } | 676 | } |
677 | 677 | ||
678 | retry: | 678 | retry: |
679 | if (rw == READ && ext4_should_dioread_nolock(inode)) { | 679 | if (iov_iter_rw(iter) == READ && ext4_should_dioread_nolock(inode)) { |
680 | /* | 680 | /* |
681 | * Nolock dioread optimization may be dynamically disabled | 681 | * Nolock dioread optimization may be dynamically disabled |
682 | * via ext4_inode_block_unlocked_dio(). Check inode's state | 682 | * via ext4_inode_block_unlocked_dio(). Check inode's state |
@@ -707,7 +707,7 @@ locked: | |||
707 | ret = blockdev_direct_IO(iocb, inode, iter, offset, | 707 | ret = blockdev_direct_IO(iocb, inode, iter, offset, |
708 | ext4_get_block); | 708 | ext4_get_block); |
709 | 709 | ||
710 | if (unlikely((rw & WRITE) && ret < 0)) { | 710 | if (unlikely(iov_iter_rw(iter) == WRITE && ret < 0)) { |
711 | loff_t isize = i_size_read(inode); | 711 | loff_t isize = i_size_read(inode); |
712 | loff_t end = offset + count; | 712 | loff_t end = offset + count; |
713 | 713 | ||