[RHEL7,COMMIT] ploop: Introduce .sync_read_many method

Submitted by Konstantin Khorenko on Feb. 5, 2020, 9:55 a.m.

Details

Message ID 202002050955.0159tImk028733@finist-ce7.sw.ru
State New
Series "Possibility to batch page reads and batch on holes_bitmap population"
Headers show

Commit Message

Konstantin Khorenko Feb. 5, 2020, 9:55 a.m.
The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.15
------>
commit 7f6683ce9e8c7ec4a1ac652c6bc5e047a72e55d4
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Wed Feb 5 12:55:18 2020 +0300

    ploop: Introduce .sync_read_many method
    
    The new method to read many pages in one batch request.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    
    Patchset description:
    Possibility to batch page reads and batch on holes_bitmap population
    
    Submit batch request up to 10 clusters (10Mb, 2560 pages)
    during holes_bitmap population to speed up ploop mount
    of big images.
    
    https://jira.sw.ru/browse/PSBM-101246
    
    Kirill Tkhai (4):
          ploop: Teach dio_sync_io() work with many pages
          ploop: Teach kaio_sync_io() work with many pages
          ploop: Introduce .sync_read_many method
          ploop: Read 10 BAT clusters on holes_bitmap population
---
 drivers/block/ploop/io_direct.c | 8 ++++++++
 drivers/block/ploop/io_kaio.c   | 8 ++++++++
 include/linux/ploop/ploop.h     | 2 ++
 3 files changed, 18 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 5b56fc59da07e..1fa7bfd6a2bbf 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -1207,6 +1207,13 @@  dio_sync_read(struct ploop_io * io, struct page * page, unsigned int len,
 	return dio_sync_io(io, READ_SYNC, pages, 1, len, off, pos);
 }
 
+static int dio_sync_read_many(struct ploop_io *io, struct page *pages[],
+			      unsigned int nr_pages, sector_t sec)
+{
+	return dio_sync_io(io, READ_SYNC, pages, nr_pages,
+			   PAGE_SIZE * nr_pages, 0, sec);
+}
+
 static int
 dio_sync_write(struct ploop_io * io, struct page * page, unsigned int len,
 	       unsigned int off, sector_t sec)
@@ -1774,6 +1781,7 @@  static struct ploop_io_ops ploop_io_ops_direct =
 	.write_page	=	dio_write_page,
 	.sync_read	=	dio_sync_read,
 	.sync_write	=	dio_sync_write,
+	.sync_read_many =	dio_sync_read_many,
 
 	.init		=	dio_init,
 	.destroy	=	dio_destroy,
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index c48b80b9785f1..beafc0a68c2ba 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -877,6 +877,13 @@  kaio_sync_write(struct ploop_io * io, struct page * page, unsigned int len,
 	return ret;
 }
 
+static int kaio_sync_read_many(struct ploop_io *io, struct page *pages[],
+				unsigned int nr_pages, sector_t sec)
+{
+	return kaio_sync_io(io, READ_SYNC, pages, nr_pages,
+			    PAGE_SIZE * nr_pages, 0, sec);
+}
+
 static int kaio_alloc_sync(struct ploop_io * io, loff_t pos, loff_t len)
 {
 	int err = __kaio_truncate(io, io->files.file, pos + len);
@@ -1160,6 +1167,7 @@  static struct ploop_io_ops ploop_io_ops_kaio =
 	.write_page	=	kaio_write_page,
 	.sync_read	=	kaio_sync_read,
 	.sync_write	=	kaio_sync_write,
+	.sync_read_many =	kaio_sync_read_many,
 
 	.init		=	kaio_init,
 	.destroy	=	kaio_destroy,
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 09333e9c34531..66591623f79d0 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -178,6 +178,8 @@  struct ploop_io_ops
 			     unsigned int len, unsigned int off, sector_t sec);
 	int	(*sync_write)(struct ploop_io * io, struct page * page,
 			      unsigned int len, unsigned int off, sector_t sec);
+	int	(*sync_read_many)(struct ploop_io *io, struct page *pages[],
+				  unsigned int nr_pages, sector_t sec);
 
 	int	(*init)(struct ploop_io * io);
 	void	(*destroy)(struct ploop_io * io);