[Devel] [PATCH RHEL7 COMMIT] ploop: kaio_kreq_alloc specify nr_segs

Konstantin Khorenko khorenko at virtuozzo.com
Mon Feb 19 14:02:57 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 08b4bb3857c46e287b84525f5c196a60e721f5c9
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Feb 19 14:02:57 2018 +0300

    ploop: kaio_kreq_alloc specify nr_segs
    
    Patchset description:
    kaio direct_io_bvec/page cleanup
    
    This patch set gertid of direct_IO_page which is redundant and broken
    for fuse.
    
    ## Ploop cleanup
    ploop: kaio_kreq_alloc specify nr_segs
    ploop: kaio_io_page switch to bvec iter
    ploop: io_kaio remove direct_IO_page requirement
    ## Fuse cleanup
    fuse: remove direct_IO_page
    fuse: assert i_size boundaries for fuse_direct_IO_bvec
    
    ======================================================
    This patch description:
    
    This patch does not change existing behavior, but allow more flexibility.
    
    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, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 998ad7454a66..ef1310e68213 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -141,16 +141,14 @@ static void kaio_rw_kreq_complete(u64 data, long res)
 	kaio_rw_aio_complete((u64)preq, res);
 }
 
-static struct kaio_req *kaio_kreq_alloc(struct ploop_request *preq, int *nr_p)
+static struct kaio_req *kaio_kreq_alloc(struct ploop_request *preq, int nr)
 {
-	static const int nr = KAIO_MAX_PAGES_PER_REQ;
 	struct kaio_req *kreq;
 
-	kreq = kmalloc(offsetof(struct kaio_req, bvecs[nr]), GFP_NOFS);
-	if (kreq) {
-		*nr_p = nr;
+	kreq = kmalloc(sizeof(struct kaio_req) + sizeof(struct bio_vec) * nr,
+		       GFP_NOFS);
+	if (kreq)
 		kreq->preq = preq;
-	}
 
 	return kreq;
 }
@@ -365,11 +363,11 @@ static void kaio_sbl_submit(struct file *file, struct ploop_request *preq,
 
 	while (size > 0) {
 		struct kaio_req *kreq;
-		int nr_segs;
+		int nr_segs = KAIO_MAX_PAGES_PER_REQ;
 		size_t copy;
 		int err;
 
-		kreq = kaio_kreq_alloc(preq, &nr_segs);
+		kreq = kaio_kreq_alloc(preq, nr_segs);
 		if (!kreq) {
 			PLOOP_REQ_SET_ERROR(preq, -ENOMEM);
 			break;


More information about the Devel mailing list