[Devel] [PATCH RHEL7 COMMIT] ext4: Handle DAX case in .read_iter

Vasily Averin vvs at virtuozzo.com
Wed Aug 26 09:47:24 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.11
------>
commit 6845d06667ebeec0f8064ec5725822c145ef8777
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Aug 26 09:47:24 2020 +0300

    ext4: Handle DAX case in .read_iter
    
    Patchset description:
    DAX may be enabled directly at mount time, while it's disabled
    by default.
    
    Despite we never enable it, the code must handle this case too
    
    Current patch description:
    Extract payload from ext4_file_read() to ext4_file_read_iter()
    and use it as .read_iter method.
    
    https://jira.sw.ru/browse/PSBM-105347
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/file.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 0ed2641..8f5fb6d 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -612,6 +612,16 @@ ext4_file_dax_read_iter(
 }
 #endif
 
+ssize_t
+ext4_file_read_iter(struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
+{
+#ifdef CONFIG_FS_DAX
+	if (IS_DAX(file_inode(iocb->ki_filp)))
+		return ext4_file_dax_read_iter(iocb, iter, pos);
+#endif
+	return generic_file_read_iter(iocb, iter, pos);
+}
+
 static ssize_t
 ext4_file_read(
 	struct kiocb		*iocb,
@@ -623,11 +633,7 @@ ext4_file_read(
 	struct iov_iter iter;
 
 	iov_iter_init(&iter, iovp, nr_segs, size, 0);
-#ifdef CONFIG_FS_DAX
-	if (IS_DAX(file_inode(iocb->ki_filp)))
-		return ext4_file_dax_read_iter(iocb, &iter, pos);
-#endif
-	return generic_file_read_iter(iocb, &iter, pos);
+	return ext4_file_read_iter(iocb, &iter, pos);
 }
 
 const struct file_operations_extend  ext4_file_operations = {
@@ -649,7 +655,7 @@ const struct file_operations_extend  ext4_file_operations = {
 		.splice_read	= generic_file_splice_read,
 		.splice_write	= generic_file_splice_write,
 		.fallocate	= ext4_fallocate,
-		.read_iter	= generic_file_read_iter,
+		.read_iter	= ext4_file_read_iter,
 		.write_iter	= ext4_file_write_iter,
 	},
 	.mmap_supported_flags = MAP_SYNC,


More information about the Devel mailing list