[Devel] [PATCH RHEL7 COMMIT] ploop: Enable 1M holes with zeroing indexes for io_kaio

Vasily Averin vvs at virtuozzo.com
Fri Aug 21 11:06:46 MSK 2020


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.3
------>
commit 7207d56e25960c0d22162a35cdcd80a9bc57bfea
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Aug 21 11:06:46 2020 +0300

    ploop: Enable 1M holes with zeroing indexes for io_kaio
    
    This just enables the functionality for testing.
    1M allocation is not implemented yet.
    
    https://jira.sw.ru/browse/PSBM-105347
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/fmt_ploop1.c |  2 +-
 drivers/block/ploop/io_kaio.c    | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 2180dfc..b5f9594 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -333,7 +333,7 @@ ploop1_open(struct ploop_delta * delta)
 	    ((u64)ph->bd_size + ph->l1_off) << 9)
 		delta->flags |= PLOOP_FMT_PREALLOCATED;
 
-	if (delta->io.ops->id != PLOOP_IO_DIRECT || kaio_backed_ext4)
+	if (delta->io.ops->id != PLOOP_IO_DIRECT && !kaio_backed_ext4)
 		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
 
 	return 0;
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 020e79f..365e2e3 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -17,6 +17,7 @@
 #include <linux/aio.h>
 
 #include <linux/ploop/ploop.h>
+#include <uapi/linux/falloc.h>
 
 #define KAIO_PREALLOC (128 * 1024 * 1024) /* 128 MB */
 
@@ -183,8 +184,17 @@ static int kaio_kernel_submit(struct file *file, struct kaio_req *kreq,
 
 	if (rw & REQ_DISCARD) {
 		op = IOCB_CMD_UNMAP_ITER;
-		if (file_inode(file)->i_sb->s_magic == EXT4_SUPER_MAGIC)
-			return -ENOTSUPP;
+		if (file_inode(file)->i_sb->s_magic == EXT4_SUPER_MAGIC) {
+			err = file->f_op->fallocate(file,
+				    FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE,
+				    pos, count);
+			if (err == 0) {
+				kaio_complete_io_request(kreq->preq);
+				/* Otherwise, caller decrements counter */
+			}
+			return err;
+		}
+
 	} else if (rw & REQ_WRITE)
 		op = IOCB_CMD_WRITE_ITER;
 	else


More information about the Devel mailing list