[Devel] [PATCH RHEL7 COMMIT] ploop: Formulate "kaio_backed_ext4" module parameter purpose

Vasily Averin vvs at virtuozzo.com
Tue Aug 25 09:04:55 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.9
------>
commit c1253660b825e125fdef5a270a8a6e0e75d3dad5
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Aug 25 09:04:55 2020 +0300

    ploop: Formulate "kaio_backed_ext4" module parameter purpose
    
    This matters in case of PLOOP_IO_AUTO is requested
    in struct ploop_ctl_chunk::pctl_type:
    1)not-zero is to choose io_kaio engine for ext4;
    2)zero is to choose io_direct.
    
    In case of certail PLOOP_IO_XXX is passed, the parameter
    is ignored.
    
    https://jira.sw.ru/browse/PSBM-105347
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c        | 6 ++++++
 drivers/block/ploop/fmt_ploop1.c | 4 +++-
 drivers/block/ploop/io_direct.c  | 5 +++--
 drivers/block/ploop/io_kaio.c    | 4 ++--
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 686d1b9..197faa5 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -61,6 +61,12 @@ static long user_threshold __read_mostly = 4L * 1024 * 1024; /* 4GB in KB */
 
 static int large_disk_support __read_mostly = 1; /* true */
 static int native_discard_support __read_mostly = 1;
+/*
+ * This matters in case of PLOOP_IO_AUTO is requested
+ * in struct ploop_ctl_chunk::pctl_type:
+ * 1)not-zero is to choose io_kaio engine for ext4;
+ * 2)zero is to choose io_direct.
+ */
 int kaio_backed_ext4 __read_mostly = 0;
 EXPORT_SYMBOL(kaio_backed_ext4);
 
diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index b5f9594..0036e09 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -333,7 +333,9 @@ 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)
+	/* FIXME: is there a better place for this? */
+	if (delta->io.ops->id != PLOOP_IO_DIRECT &&
+	    delta->io.files.inode->i_sb->s_magic != EXT4_SUPER_MAGIC)
 		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
 
 	return 0;
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index db3eacd..4f82b8b 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -1721,11 +1721,12 @@ static int dio_autodetect(struct ploop_io *io, unsigned int id)
 	mm_segment_t fs;
 	unsigned int flags;
 
-	if (kaio_backed_ext4)
-		return -1;
 	if (inode->i_sb->s_magic != EXT4_SUPER_MAGIC)
 		return -1; /* not mine */
 
+	if (id == PLOOP_IO_AUTO && kaio_backed_ext4)
+		return -1;
+
 	if (inode->i_sb->s_bdev == NULL) {
 		printk("File on FS EXT(%s) without backing device\n", s_id);
 		return -1;
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 38599e2..2f6164c 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1138,7 +1138,6 @@ static void kaio_queue_settings(struct ploop_io * io, struct request_queue * q)
 	struct inode *inode = file->f_mapping->host;
 
 	if (inode->i_sb->s_magic == EXT4_SUPER_MAGIC) {
-		WARN_ON(!kaio_backed_ext4);
 		blk_queue_stack_limits(q, bdev_get_queue(io->files.bdev));
 		/*
 		 * There is no a way to force block engine to split a request
@@ -1214,7 +1213,8 @@ static int kaio_autodetect(struct ploop_io *io, unsigned int id)
 	struct inode * inode = file->f_mapping->host;
 
 	if (inode->i_sb->s_magic != FUSE_SUPER_MAGIC &&
-	    (inode->i_sb->s_magic != EXT4_SUPER_MAGIC || !kaio_backed_ext4))
+	    (inode->i_sb->s_magic != EXT4_SUPER_MAGIC ||
+	     (id == PLOOP_IO_AUTO && !kaio_backed_ext4)))
 		return -1; /* not mine */
 
 	if (!(file->f_flags & O_DIRECT)) {


More information about the Devel mailing list