[Devel] [PATCH RH8] ploop: Add GFP_NOIO brackets around call_read_iter()

Kirill Tkhai ktkhai at virtuozzo.com
Fri Jan 22 13:52:06 MSK 2021


Force all allocation to do not result in IO.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 74f9b199d273..0fa5f48eceb6 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1,6 +1,7 @@
 #include <linux/buffer_head.h>
 #include <linux/dm-io.h>
 #include <linux/dm-kcopyd.h>
+#include <linux/sched/mm.h>
 #include <linux/init.h>
 #include <linux/vmalloc.h>
 #include <linux/uio.h>
@@ -917,10 +918,10 @@ static void ploop_read_aio_complete(struct kiocb *iocb, long ret, long ret2)
 static void submit_delta_read(struct ploop *ploop, unsigned int level,
 			    unsigned int dst_cluster, struct bio *bio)
 {
+	unsigned int flags, offset;
 	struct ploop_iocb *piocb;
 	struct bio_vec *bvec;
 	struct iov_iter iter;
-	unsigned int offset;
 	struct file *file;
 	loff_t pos;
 	int ret;
@@ -951,7 +952,9 @@ static void submit_delta_read(struct ploop *ploop, unsigned int level,
 	piocb->iocb.ki_flags = IOCB_DIRECT;
 	piocb->iocb.ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
 
+	flags = memalloc_noio_save();
 	ret = call_read_iter(file, &piocb->iocb, &iter);
+	memalloc_noio_restore(flags);
 
 	ploop_read_aio_do_completion(piocb);
 




More information about the Devel mailing list