[Devel] [PATCH RHEL8 COMMIT] push_backup: Kill find_node_pbio_range()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 10 20:16:44 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.11
------>
commit 6cb4cbd365137048bc63d8bed7a03aa4219c359f
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Sep 10 20:16:44 2021 +0300

    push_backup: Kill find_node_pbio_range()
    
    This is preparation to reworking the driver.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ====================
    push_backup: Make target !immutable.
    
    https://jira.sw.ru/browse/PSBM-127989
    
    Kirill Tkhai (14):
          push_backup: Rename ppb_map
          push_backup: Add unsigned long alignment
          push_backup: Add pending_map
          push_backup: Kill find_node_pbio_range()
          push_backup: Use nr_delayed in postpone_if_required_for_backup()
          push_backup: Introduce hash table
          push_backup: Leave pending pbio in pending queue
          push_backup: Do not split bios by cluster size
          dm: Allow singleton target with devices attached
          dm: Introduce dm_requeue_original_rq()
          push_backup: Make it request based
          push_backup: Change retval postpone_if_required_for_backup()
          push_backup: Change arguments of calc_bio_clusters()
          push_backup: Make the target !immutable
---
 drivers/md/dm-push-backup.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
index a9b5d264b493..739f1a8a5e6a 100644
--- a/drivers/md/dm-push-backup.c
+++ b/drivers/md/dm-push-backup.c
@@ -117,17 +117,16 @@ static void unlink_node_pbio(struct rb_root *root, struct pb_bio *pbio)
 	RB_CLEAR_NODE(&pbio->node);
 }
 
-static struct pb_bio *find_node_pbio_range(struct rb_root *root,
-					   u64 left, u64 right)
+static struct pb_bio *find_node_pbio(struct rb_root *root, u64 clu)
 {
 	struct rb_node *node = root->rb_node;
 	struct pb_bio *h;
 
 	while (node) {
 		h = rb_entry(node, struct pb_bio, node);
-		if (right < h->clu)
+		if (clu < h->clu)
 			node = node->rb_left;
-		else if (left > h->clu)
+		else if (clu > h->clu)
 			node = node->rb_right;
 		else
 			return h;
@@ -136,11 +135,6 @@ static struct pb_bio *find_node_pbio_range(struct rb_root *root,
 	return NULL;
 }
 
-static struct pb_bio *find_node_pbio(struct rb_root *root, u64 clu)
-{
-	return find_node_pbio_range(root, clu, clu);
-}
-
 static void unlink_postponed_backup_pbio(struct push_backup *pb,
 					 struct bio_list *bio_list,
 					 struct pb_bio *pbio)
@@ -475,12 +469,13 @@ static int push_backup_write(struct push_backup *pb,
 
 	finished = (pb->map_bits == 0);
 
-	for (i = 0; i < nr; i++) {
-		pbio = find_node_pbio_range(&pb->rb_root, clu,
-					    clu + nr - 1);
-		if (!pbio)
-			break;
-		unlink_postponed_backup_pbio(pb, &bio_list, pbio);
+	for (i = clu; i < clu + nr; i++) {
+		while (1) {
+			pbio = find_node_pbio(&pb->rb_root, i);
+			if (!pbio)
+				break;
+			unlink_postponed_backup_pbio(pb, &bio_list, pbio);
+		}
 	}
 
 	has_more = !RB_EMPTY_ROOT(&pb->rb_root);


More information about the Devel mailing list