[Devel] [PATCH RHEL7 COMMIT] ploop: kaio_io_page switch to bvec iter

Konstantin Khorenko khorenko at virtuozzo.com
Mon Feb 19 14:02:58 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.43.7
------>
commit ad01e6c685688f221b2398036b764f33181707cd
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Feb 19 14:02:58 2018 +0300

    ploop: kaio_io_page switch to bvec iter
    
    iov_iter_page is crappy interface. In fact single page is just
    a particular case of bvec. It is reasonable to switch to bvec.
    
    https://jira.sw.ru/browse/PSBM-80680
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 drivers/block/ploop/io_kaio.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index ef1310e68213..10b841a012f8 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -662,6 +662,7 @@ kaio_io_page(struct ploop_io * io, int op, struct ploop_request * preq,
 	struct iov_iter iter;
 	loff_t pos = (loff_t) sec << 9;
 	struct file *file = io->files.file;
+	struct kaio_req *kreq;
 	int err;
 
 	ploop_prepare_io_request(preq);
@@ -671,10 +672,19 @@ kaio_io_page(struct ploop_io * io, int op, struct ploop_request * preq,
 		PLOOP_REQ_SET_ERROR(preq, -ENOMEM);
 		goto out;
 	}
+	kreq = kaio_kreq_alloc(preq, 1);
+	if (!kreq) {
+		aio_kernel_free(iocb);
+		PLOOP_REQ_SET_ERROR(preq, -ENOMEM);
+		goto out;
+	}
+	kreq->bvecs->bv_page = page;
+	kreq->bvecs->bv_offset = 0;
+	kreq->bvecs->bv_len = PAGE_SIZE;
 
-	iov_iter_init_page(&iter, page, PAGE_SIZE, 0);
+	iov_iter_init_bvec(&iter, kreq->bvecs, 1, PAGE_SIZE, 0);
 	aio_kernel_init_iter(iocb, file, op, &iter, pos);
-	aio_kernel_init_callback(iocb, kaio_rw_aio_complete, (u64)preq);
+	aio_kernel_init_callback(iocb, kaio_rw_kreq_complete, (u64)kreq);
 
 	atomic_inc(&preq->io_count);
 


More information about the Devel mailing list