[RHEL7,COMMIT] ploop: Do not do useless preallocation in kaio_submit_alloc()

Submitted by Vasily Averin on Sept. 20, 2020, 9:02 a.m.

Details

Message ID 202009200902.08K92Nda015795@vz7build.vvs.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin Sept. 20, 2020, 9:02 a.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.26
------>
commit e1db1508a16ee2ac6636b7ce1a11b4b5c50a2318
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Sun Sep 20 12:02:23 2020 +0300

    ploop: Do not do useless preallocation in kaio_submit_alloc()
    
    io->prealloced_size == end_pos means desired cluster
    is already preallocated.
    
    https://jira.sw.ru/browse/PSBM-108008
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 00316e7..19d9b0a 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -582,7 +582,7 @@  kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 
 	BUG_ON(preq->prealloc_size);
 
-	if (unlikely(io->prealloced_size < end_pos + clu_siz)) {
+	if (unlikely(io->prealloced_size < end_pos)) {
 		isize = i_size_read(io->files.inode);
 		/*
 		 * FIXME: We never initialize io->prealloced_size,
@@ -591,13 +591,12 @@  kaio_submit_alloc(struct ploop_io *io, struct ploop_request * preq,
 		 */
 		if (unlikely(io->prealloced_size < isize)) {
 			io->prealloced_size = isize;
-			if (io->prealloced_size >= end_pos + clu_siz)
+			if (io->prealloced_size >= end_pos)
 				goto submit;
 		}
 
 		if (!io->prealloc_preq) {
-			loff_t pos = (((loff_t)(iblk + 1)  << log) |
-				      (KAIO_PREALLOC - 1)) + 1;
+			loff_t pos = (end_pos | (KAIO_PREALLOC - 1)) + 1;
 
 			BUG_ON(preq->prealloc_size);
 			preq->prealloc_size = pos;