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

Kirill Tkhai ktkhai at virtuozzo.com
Wed May 20 19:05:53 MSK 2020


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 at virtuozzo.com>
---
 fs/ext4/file.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

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;
 }




More information about the Devel mailing list