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

Submitted by Kirill Tkhai on Sept. 16, 2020, 8:14 p.m.

Details

Message ID 160028726278.28444.3295920237513107386.stgit@qvm3002.qa.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Sept. 16, 2020, 8:14 p.m.
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@virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

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);