[RH7,2/2] ploop: Formulate "kaio_backed_ext4" module parameter purpose

Submitted by Kirill Tkhai on Aug. 24, 2020, 4:42 p.m.

Details

Message ID 159828731839.128627.2133726276272670131.stgit@localhost.localdomain
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Aug. 24, 2020, 4:42 p.m.
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.

Signed-off-by: Kirill Tkhai <ktkhai@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(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 686d1b96bdae..197faa5db05d 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 b5f95946c801..0036e09b4bf4 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 db3eacd2d845..4f82b8b5ce36 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 38599e201163..2f6164cc16fd 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)) {