[RHEL7,COMMIT] mm: Kill useless mapping_direct_IO()

Submitted by Konstantin Khorenko on May 25, 2020, 2:52 p.m.

Details

Message ID 202005251452.04PEqDuB003940@finist-ce7.sw.ru
State New
Series "fs, direct_IO: Switch to iov_iter and allow bio_vec for ext4"
Headers show

Commit Message

Konstantin Khorenko May 25, 2020, 2:52 p.m.
The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.161.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.161.1
------>
commit c836771aed7d1d1d5792110b7bcf523651304496
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Mon May 25 17:52:13 2020 +0300

    mm: Kill useless mapping_direct_IO()
    
    This was vz6/7-only function.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    
    =====================
    Patchset description:
    [00/30] fs,direct_IO: Switch to iov_iter and allow bio_vec for ext4
    
    This patchset transforms direct_IO callbacks, blockdev_direct_IO
    and its underlining functions to iov_iter, and introduces complete
    support of iov_iter for ext4.
    
    Supported iov_iter subtypes for ext4 is iovec and bio_vec. The first
    is for traditional user-submitted aio, while bio_vec is the type,
    which is important for us, since we use it in ploop.
    
    bio_vec operates with pages instead of user addresses (like iovec
    does), so it requires specific callbacks in do_blockdev_direct_IO()
    and in the functions it calls.
    
    The patchset reworks do_blockdev_direct_IO() in the same manner
    as in mainstrean. The most of rest patches are prepared manually,
    since we have significant differences to ms (RHEL7 patches, our
    direct IO patches for FUSE; all they have changed many functions).
    At the end, kaio engine (resulting in direct_IO) became possible
    to be enabled for ext4.
    
    https://jira.sw.ru/browse/PSBM-99793
---
 include/linux/fs.h | 7 -------
 mm/filemap.c       | 5 ++---
 mm/page_io.c       | 2 +-
 3 files changed, 3 insertions(+), 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/linux/fs.h b/include/linux/fs.h
index dfef79262fc2f..c316af9cf3631 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3651,13 +3651,6 @@  static inline iop_dentry_open_t get_dentry_open_iop(struct inode *inode)
 	return wrapper ? wrapper->dentry_open : NULL;
 }
 
-static inline ssize_t mapping_direct_IO(struct address_space *mapping, int rw,
-			         struct kiocb *iocb, struct iov_iter *iter,
-			         loff_t pos)
-{
-	return mapping->a_ops->direct_IO(rw, iocb, iter, pos);
-}
-
 extern bool path_noexec(const struct path *path);
 
 #endif /* _LINUX_FS_H */
diff --git a/mm/filemap.c b/mm/filemap.c
index 0619290ecd978..1a59ee8d38c13 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2036,8 +2036,7 @@  generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
 		retval = filemap_write_and_wait_range(mapping, pos,
 				pos + count - 1);
 		if (!retval) {
-			retval = mapping_direct_IO(mapping, READ,
-						   iocb, iter, pos);
+			retval = mapping->a_ops->direct_IO(READ, iocb, &data, pos);
 		}
 		if (retval > 0) {
 			*ppos = pos + retval;
@@ -2803,7 +2802,7 @@  generic_file_direct_write(struct kiocb *iocb, struct iov_iter *iter,
 		goto out;
 	}
 
-	written = mapping_direct_IO(mapping, WRITE, iocb, iter, pos);
+	written = mapping->a_ops->direct_IO(WRITE, iocb, &data, pos);
 
 	/*
 	 * Finally, try again to invalidate clean pages which might have been
diff --git a/mm/page_io.c b/mm/page_io.c
index d2bd82848946a..8611924c59c0f 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -235,7 +235,7 @@  int __swap_writepage(struct page *page, struct writeback_control *wbc,
 
 		set_page_writeback(page);
 		unlock_page(page);
-		ret = mapping_direct_IO(mapping, KERNEL_WRITE,
+		ret = mapping->a_ops->direct_IO(KERNEL_WRITE,
 					&kiocb, &iter, kiocb.ki_pos);
 		kunmap(page);
 		if (ret == PAGE_SIZE) {