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

Kirill Tkhai ktkhai at virtuozzo.com
Sat Sep 19 19:51:06 MSK 2020


io->prealloced_size == end_pos means desired cluster
is already preallocated.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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;



More information about the Devel mailing list