[rh7,25/30] fs: More use iov_iter in ext4_file_write()

Submitted by Kirill Tkhai on May 20, 2020, 4:05 p.m.

Details

Message ID 158999075153.2234365.6533212255009509169.stgit@localhost.localdomain
State New
Series "fs, direct_IO: Switch to iov_iter and allow bio_vec for ext4"
Headers show

Commit Message

Kirill Tkhai May 20, 2020, 4:05 p.m.
1)After iov_iter is added as local variable at start
 of this function, we should not introduce it again
 for ext4_file_dio_write().

2)Instead of generic_file_aio_write() we use its
iov_iter variant generic_file_write_iter()

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/ext4/file.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 36622e82d152..43c37e05cdb3 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -273,14 +273,10 @@  ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
 #endif
 
 	iocb->private = &overwrite; /* RHEL7 only - prevent DIO race */
-	if (unlikely(io_is_direct(iocb->ki_filp))) {
-		struct iov_iter iter;
-
-		iov_iter_init(&iter, iov, nr_segs, iov_length(iov, nr_segs), 0);
-
+	if (unlikely(io_is_direct(iocb->ki_filp)))
 		ret = ext4_file_dio_write(iocb, &iter, pos);
-	} else
-		ret = generic_file_aio_write(iocb, iov, nr_segs, pos);
+	else
+		ret = generic_file_write_iter(iocb, &iter, pos);
 
 	return ret;
 }