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

Submitted by Vasily Averin on Aug. 26, 2020, 6:47 a.m.

Details

Message ID 202008260647.07Q6lOcS002425@vz7build.vvs.sw.ru
State New
Series "ext4 read_iter/fastmap: DAX handling"
Headers show

Commit Message

Vasily Averin Aug. 26, 2020, 6:47 a.m.
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@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@virtuozzo.com>
---
 fs/ext4/file.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

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,