[rh7,16/30] dio: take updating ->result into do_direct_IO()

Submitted by Kirill Tkhai on May 20, 2020, 4:04 p.m.

Details

Message ID 158999068835.2234365.1372601297970524276.stgit@localhost.localdomain
State New
Series "fs, direct_IO: Switch to iov_iter and allow bio_vec for ext4"
Headers show

Commit Message

Kirill Tkhai May 20, 2020, 4:04 p.m.
ms commit 3320c60b3a26

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/direct-io.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1183db2f5903..39b76e93aaea 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1088,6 +1088,7 @@  static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
 						1 << blkbits);
 				sdio->block_in_file++;
 				block_in_page++;
+				dio->result += 1 << blkbits;
 				goto next_block;
 			}
 
@@ -1129,6 +1130,7 @@  static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
 			sdio->block_in_file += this_chunk_blocks;
 			block_in_page += this_chunk_blocks;
 			sdio->blocks_available -= this_chunk_blocks;
+			dio->result += this_chunk_blocks << blkbits;
 next_block:
 			BUG_ON(sdio->block_in_file > sdio->final_block_in_request);
 			if (sdio->block_in_file == sdio->final_block_in_request)
@@ -1379,10 +1381,6 @@  do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 
 		retval = do_direct_IO(dio, &sdio, &map_bh);
 
-		dio->result += iov[seg].iov_len -
-			((sdio.final_block_in_request - sdio.block_in_file) <<
-					blkbits);
-
 		if (retval) {
 			dio_cleanup(dio, &sdio);
 			break;