[Devel] [PATCH RHEL7 COMMIT] dio: take updating ->result into do_direct_IO()

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 25 17:52:22 MSK 2020


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 a354c3aeca8c2c177ad792678e81cf36d85026c7
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 25 17:52:22 2020 +0300

    dio: take updating ->result into do_direct_IO()
    
    ms commit 3320c60b3a26
    
    Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
    Signed-off-by: Kirill Tkhai <ktkhai at 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/direct-io.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1183db2f59039..39b76e93aaea3 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;


More information about the Devel mailing list