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/inode.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/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 76b8cba5d041..cf6ba6536035 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2952,8 +2952,8 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, | |||
2952 | * if the machine crashes during the write. | 2952 | * if the machine crashes during the write. |
2953 | * | 2953 | * |
2954 | */ | 2954 | */ |
2955 | static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | 2955 | static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, |
2956 | struct iov_iter *iter, loff_t offset) | 2956 | loff_t offset) |
2957 | { | 2957 | { |
2958 | struct file *file = iocb->ki_filp; | 2958 | struct file *file = iocb->ki_filp; |
2959 | struct inode *inode = file->f_mapping->host; | 2959 | struct inode *inode = file->f_mapping->host; |
@@ -2966,8 +2966,8 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
2966 | ext4_io_end_t *io_end = NULL; | 2966 | ext4_io_end_t *io_end = NULL; |
2967 | 2967 | ||
2968 | /* Use the old path for reads and writes beyond i_size. */ | 2968 | /* Use the old path for reads and writes beyond i_size. */ |
2969 | if (rw != WRITE || final_size > inode->i_size) | 2969 | if (iov_iter_rw(iter) != WRITE || final_size > inode->i_size) |
2970 | return ext4_ind_direct_IO(rw, iocb, iter, offset); | 2970 | return ext4_ind_direct_IO(iocb, iter, offset); |
2971 | 2971 | ||
2972 | BUG_ON(iocb->private == NULL); | 2972 | BUG_ON(iocb->private == NULL); |
2973 | 2973 | ||
@@ -2976,7 +2976,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
2976 | * conversion. This also disallows race between truncate() and | 2976 | * conversion. This also disallows race between truncate() and |
2977 | * overwrite DIO as i_dio_count needs to be incremented under i_mutex. | 2977 | * overwrite DIO as i_dio_count needs to be incremented under i_mutex. |
2978 | */ | 2978 | */ |
2979 | if (rw == WRITE) | 2979 | if (iov_iter_rw(iter) == WRITE) |
2980 | atomic_inc(&inode->i_dio_count); | 2980 | atomic_inc(&inode->i_dio_count); |
2981 | 2981 | ||
2982 | /* If we do a overwrite dio, i_mutex locking can be released */ | 2982 | /* If we do a overwrite dio, i_mutex locking can be released */ |
@@ -3078,7 +3078,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
3078 | } | 3078 | } |
3079 | 3079 | ||
3080 | retake_lock: | 3080 | retake_lock: |
3081 | if (rw == WRITE) | 3081 | if (iov_iter_rw(iter) == WRITE) |
3082 | inode_dio_done(inode); | 3082 | inode_dio_done(inode); |
3083 | /* take i_mutex locking again if we do a ovewrite dio */ | 3083 | /* take i_mutex locking again if we do a ovewrite dio */ |
3084 | if (overwrite) { | 3084 | if (overwrite) { |
@@ -3107,12 +3107,12 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
3107 | if (ext4_has_inline_data(inode)) | 3107 | if (ext4_has_inline_data(inode)) |
3108 | return 0; | 3108 | return 0; |
3109 | 3109 | ||
3110 | trace_ext4_direct_IO_enter(inode, offset, count, rw); | 3110 | trace_ext4_direct_IO_enter(inode, offset, count, iov_iter_rw(iter)); |
3111 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) | 3111 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) |
3112 | ret = ext4_ext_direct_IO(rw, iocb, iter, offset); | 3112 | ret = ext4_ext_direct_IO(iocb, iter, offset); |
3113 | else | 3113 | else |
3114 | ret = ext4_ind_direct_IO(rw, iocb, iter, offset); | 3114 | ret = ext4_ind_direct_IO(iocb, iter, offset); |
3115 | trace_ext4_direct_IO_exit(inode, offset, count, rw, ret); | 3115 | trace_ext4_direct_IO_exit(inode, offset, count, iov_iter_rw(iter), ret); |
3116 | return ret; | 3116 | return ret; |
3117 | } | 3117 | } |
3118 | 3118 | ||