[Devel] [PATCH RHEL7 COMMIT] ploop: Transform never-true check

Vasily Averin vvs at virtuozzo.com
Thu Sep 17 12:39:43 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.23
------>
commit 5694011ae94ef9fc9846a9db61f40617ff66b702
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Sep 17 12:39:43 2020 +0300

    ploop: Transform never-true check
    
    kaio does not have PLOOP_IO_FSYNC_DELAYED bit set,
    so this statement is never true.
    
    But even in kaio case is not a good idea to send
    flush or fua requests via fastmap. Kaio has special
    fsync_thread for that.
    
    Found in scope of (but not a reason of):
    https://jira.sw.ru/browse/PSBM-107643
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 6436f5c..f85dac1 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1204,20 +1204,11 @@ kaio_fastmap(struct ploop_io *io, struct bio *orig_bio,
 	if (!inode->i_op->fastmap)
 		return 1;
 
-	if (unlikely((orig_bio->bi_rw & (REQ_FLUSH | REQ_FUA)) &&
-		     test_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state)))
+	/* We have special fsync_thread for flushing */
+	if (unlikely(orig_bio->bi_rw & (REQ_FLUSH | REQ_FUA)))
 		return 1;
 
-	if (orig_bio->bi_size == 0) {
-		bio->bi_vcnt   = 0;
-		bio->bi_sector = 0;
-		bio->bi_size   = 0;
-		bio->bi_idx    = 0;
-
-		bio->bi_rw   = orig_bio->bi_rw;
-		bio->bi_bdev = io->files.bdev;
-		return 0;
-	}
+	BUG_ON(orig_bio->bi_size == 0);
 
 	ret = inode->i_op->fastmap(inode, isec, orig_bio->bi_size, &phys_sec,
 				   orig_bio->bi_rw & REQ_WRITE);


More information about the Devel mailing list