[RH7,2/4] ploop: Do not do useless preallocation in kaio_submit_alloc()

Submitted by Kirill Tkhai on Sept. 19, 2020, 4:51 p.m.

Details

Message ID 160053426379.24001.17815717392507018574.stgit@qvm3002.qa.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Sept. 19, 2020, 4:51 p.m.
io->prealloced_size == end_pos means desired cluster
is already preallocated.

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;