[Devel] [PATCH RHEL7 COMMIT] ploop: Ignore clusters above holes_bitmap

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 14 19:13:08 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.15
------>
commit 9e79e31468f60f4d7e43a4d0f47a3cebf58a0e09
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jun 14 19:13:06 2019 +0300

    ploop: Ignore clusters above holes_bitmap
    
    On grow we may assign cluster above holes_bitmap
    in case of old holes_bitmap is not enough to fit
    intensive io. Handle this.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/fmt_ploop1.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 990ac79432ea..8a890577e35d 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -207,8 +207,13 @@ static int populate_holes_bitmap(struct ploop_delta *delta,
 		index = page_address(page);
 		for (i = off; i < INDEX_PER_PAGE && block + i - off < nr_blocks; i++) {
 			if (index[i] != 0) {
-				ploop_clear_holes_bitmap_bit(
-						index[i] >> ploop_map_log(delta->plo), delta);
+				unsigned int cluster = index[i] >> ploop_map_log(delta->plo);
+				/*
+				 * On grow cluster above nr_clusters_in_bitmap may
+				 * be assigned. Ignore it.
+				 */
+				if (likely(cluster < ph->nr_clusters_in_bitmap))
+					ploop_clear_holes_bitmap_bit(cluster, delta);
 			}
 		}
 
@@ -823,6 +828,7 @@ static int ploop1_complete_grow(struct ploop_delta * delta, u64 new_size)
 
 static void ploop1_add_free_blk(struct ploop_delta *delta, struct ploop_request *preq)
 {
+	struct ploop1_private *ph = delta->priv;
 	struct map_node *m = preq->map;
 	cluster_t cluster;
 	map_index_t blk;
@@ -839,6 +845,13 @@ static void ploop1_add_free_blk(struct ploop_delta *delta, struct ploop_request
 		return;
 
 	cluster = blk >> ploop_map_log(delta->plo);
+	if (cluster > ph->nr_clusters_in_bitmap) {
+		/*
+		 * On grow cluster above nr_clusters_in_bitmap
+		 * may be assigned. Here we handle that.
+		 */
+		return;
+	}
 
 	WARN_ON_ONCE(test_bit(cluster, delta->holes_bitmap));
 	ploop_set_holes_bitmap_bit(cluster, delta->holes_bitmap);



More information about the Devel mailing list