[Devel] [PATCH rh7 11/30] fs: Replace iov_length() with its iov_iter synonym iov_iter_count()

Kirill Tkhai ktkhai at virtuozzo.com
Wed May 20 19:04:13 MSK 2020


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 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(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8afc46c2e561..f2cdbdce472a 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 882c636c3df5..868a438f73c6 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 917b124e1ffc..bea45cc565b9 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 c0649bdd50ed..f7fe0253d5b3 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 0e0c19842875..3899484855c9 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 0db84dc50090..fb9df57ae800 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 43c4874a5759..2546c965b432 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 409aeaacba1a..4b58be70933e 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 e756fb0edfe1..5a59a4dc1e67 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 866a34ec51c5..b56120dbf55a 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 5cd00676959d..26d9d9f55f44 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;
 }
 




More information about the Devel mailing list