[Devel] [PATCH VZ9] dm-qcow2 use helper to initialize kiocb

Alexander Atanasov alexander.atanasov at virtuozzo.com
Tue Sep 20 11:25:32 MSK 2022


initialize kiocb with init_sync_kiocb(...)
which handles file flags, write hints and ioprio.
bios can get merged wrong if ioprio is not set early -
(20578bdfd041 block: Initialize BIO I/O priority early) for details

https://jira.sw.ru/browse/PSBM-142050
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-qcow2-target.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index 995679b3cd98..cab14d12fd30 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -4,6 +4,7 @@
  */
 #include <linux/prandom.h>
 #include <linux/uio.h>
+#include <linux/fs.h>
 
 #include "dm.h"
 #include "dm-qcow2.h"
@@ -122,11 +123,9 @@ void call_rw_iter(struct qcow2 *qcow2, loff_t pos, unsigned int rw,
 	struct file *file = qcow2->file;
 	int ret;
 
+	init_sync_kiocb(iocb, file);
 	iocb->ki_pos = pos;
-	iocb->ki_filp = file;
 	iocb->ki_complete = qcow2_aio_complete;
-	iocb->ki_flags = IOCB_DIRECT;
-	iocb->ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
 
 	atomic_set(&qio->aio_ref, 2);
 
-- 
2.31.1



More information about the Devel mailing list