[Devel] [PATCH RH7 2/2] ploop: Transform never-true check

Kirill Tkhai ktkhai at virtuozzo.com
Wed Sep 16 23:14:24 MSK 2020


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