[RHEL7,COMMIT] fs: Replace iov_length() with its iov_iter synonym iov_iter_count()

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

Details

Message ID 202005251452.04PEqGpM004040@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 f673708d30614161c0b37d54795f21068ff601e8
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Mon May 25 17:52:15 2020 +0300

    fs: Replace iov_length() with its iov_iter synonym iov_iter_count()
    
    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
---
 fs/btrfs/inode.c    | 2 +-
 fs/ext2/inode.c     | 2 +-
 fs/ext3/inode.c     | 8 ++++----
 fs/fat/inode.c      | 4 ++--
 fs/gfs2/aops.c      | 2 +-
 fs/hfs/inode.c      | 2 +-
 fs/hfsplus/inode.c  | 2 +-
 fs/jfs/inode.c      | 2 +-
 fs/nilfs2/inode.c   | 2 +-
 fs/reiserfs/inode.c | 2 +-
 fs/udf/inode.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8afc46c2e5616..f2cdbdce472a5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8673,7 +8673,7 @@  static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
 	 * we need to flush the dirty pages again to make absolutely sure
 	 * that any outstanding dirty pages are on disk.
 	 */
-	count = iov_length(iov, nr_segs);
+	count = iov_iter_count(iter);
 	if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
 		     &BTRFS_I(inode)->runtime_flags))
 		filemap_fdatawrite_range(inode->i_mapping, offset,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 882c636c3df59..868a438f73c63 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -869,7 +869,7 @@  ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
 		ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
 					 ext2_get_block);
 	if (ret < 0 && (rw & WRITE))
-		ext2_write_failed(mapping, offset + iov_length(iov, nr_segs));
+		ext2_write_failed(mapping, offset + iov_iter_count(iter));
 	return ret;
 }
 
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 917b124e1ffca..bea45cc565b92 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1871,10 +1871,10 @@  static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
 	handle_t *handle;
 	ssize_t ret;
 	int orphan = 0;
-	size_t count = iov_length(iov, nr_segs);
+	size_t count = iov_iter_count(iter);
 	int retries = 0;
 
-	trace_ext3_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
+	trace_ext3_direct_IO_enter(inode, offset, iov_iter_count(iter), rw);
 
 	if (rw == WRITE) {
 		loff_t final_size = offset + count;
@@ -1906,7 +1906,7 @@  static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (unlikely((rw & WRITE) && ret < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if (end > isize)
 			ext3_truncate_failed_direct_write(inode);
@@ -1950,7 +1950,7 @@  static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
 	}
 out:
 	trace_ext3_direct_IO_exit(inode, offset,
-				iov_length(iov, nr_segs), rw, ret);
+				iov_iter_count(iter), rw, ret);
 	return ret;
 }
 
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index c0649bdd50ed7..f7fe0253d5b3c 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -205,7 +205,7 @@  static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
 		 *
 		 * Return 0, and fallback to normal buffered write.
 		 */
-		loff_t size = offset + iov_length(iov, nr_segs);
+		loff_t size = offset + iov_iter_count(iter);
 		if (MSDOS_I(inode)->mmu_private < size)
 			return 0;
 	}
@@ -217,7 +217,7 @@  static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
 	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
 				 fat_get_block);
 	if (ret < 0 && (rw & WRITE))
-		fat_write_failed(mapping, offset + iov_length(iov, nr_segs));
+		fat_write_failed(mapping, offset + iov_iter_count(iter));
 
 	return ret;
 }
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 0e0c198428758..3899484855c96 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1111,7 +1111,7 @@  static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (mapping->nrpages) {
 		loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1);
-		loff_t len = iov_length(iov, nr_segs);
+		loff_t len = iov_iter_count(iter);
 		loff_t end = PAGE_ALIGN(offset + len) - 1;
 
 		rv = 0;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 0db84dc50090d..fb9df57ae8009 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -143,7 +143,7 @@  static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (unlikely((rw & WRITE) && ret < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if (end > isize)
 			hfs_write_failed(mapping, end);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 43c4874a57595..2546c965b4326 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -140,7 +140,7 @@  static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (unlikely((rw & WRITE) && ret < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if (end > isize)
 			hfsplus_write_failed(mapping, end);
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 409aeaacba1a0..4b58be70933e1 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -349,7 +349,7 @@  static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (unlikely((rw & WRITE) && ret < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if (end > isize)
 			jfs_write_failed(mapping, end);
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index e756fb0edfe1d..5a59a4dc1e67f 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -321,7 +321,7 @@  nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
 	 */
 	if (unlikely((rw & WRITE) && size < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if (end > isize)
 			nilfs_write_failed(mapping, end);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 866a34ec51c5c..b56120dbf55a2 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -3090,7 +3090,7 @@  static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
 	 */
 	if (unlikely((rw & WRITE) && ret < 0)) {
 		loff_t isize = i_size_read(inode);
-		loff_t end = offset + iov_length(iov, nr_segs);
+		loff_t end = offset + iov_iter_count(iter);
 
 		if ((end > isize) && inode_newsize_ok(inode, isize) == 0) {
 			truncate_setsize(inode, isize);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 5cd00676959d0..26d9d9f55f441 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -230,7 +230,7 @@  static ssize_t udf_direct_IO(int rw, struct kiocb *iocb,
 	ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
 				  udf_get_block);
 	if (unlikely(ret < 0 && (rw & WRITE)))
-		udf_write_failed(mapping, offset + iov_length(iov, nr_segs));
+		udf_write_failed(mapping, offset + iov_iter_count(iter));
 	return ret;
 }