[Devel] [PATCH RHEL8 COMMIT] ploop: Support images with cluster size up to 4MB

Konstantin Khorenko khorenko at virtuozzo.com
Tue Dec 10 18:28:45 MSK 2019


The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.6
------>
commit 42e36152375452b6b2ecf7862c20945ca17212ec
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Dec 10 18:28:43 2019 +0300

    ploop: Support images with cluster size up to 4MB
    
    bio_alloc() can allocate a bio of 256 pages max (1MB).
    bio_kmalloc() can allocate a bio of 1024 pages max (4MB).
    
    Cluster sizes above 4MB are not supported (does anybody
    need this?) Possible, userspace just needs to convert
    images with bigger cluster sizes to default.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-bat.c | 3 ---
 drivers/md/dm-ploop-cmd.c | 5 ++++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index a4358e37982f..cea14556278a 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -117,10 +117,7 @@ int ploop_read_metadata(struct dm_target *ti, struct ploop *ploop)
 	int ret;
 	void *data;
 
-	/* Hardcode cluster size 1M for now ... FIXME */
 	cluster_log = ploop->cluster_log;
-	if (cluster_log != 11)
-		return -ENOTSUPP;
 
 	bio = alloc_bio_with_pages(ploop);
 	if (!bio)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 8081b4d89ba2..590edbfeb132 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -364,7 +364,10 @@ struct bio *alloc_bio_with_pages(struct ploop *ploop)
 	int i, nr_pages = nr_pages_in_cluster(ploop);
 	struct bio *bio;
 
-	bio = bio_alloc(GFP_NOIO, nr_pages);
+	if (nr_pages <= BIO_MAX_PAGES)
+		bio = bio_alloc(GFP_NOIO, nr_pages);
+	else
+		bio = bio_kmalloc(GFP_NOIO, nr_pages);
 	if (!bio)
 		return NULL;
 



More information about the Devel mailing list