[Devel] [PATCH RHEL8 COMMIT] ploop: Move find_and_clear_dst_cluster_bit() into function

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 24 12:57:20 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.31
------>
commit c75aed4f760454d0c6f81ca357e1aaf5da622118
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 24 12:57:20 2021 +0300

    ploop: Move find_and_clear_dst_cluster_bit() into function
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Truncate top delta from kernel
    
    and refactoring at tail.
    
    https://jira.sw.ru/browse/PSBM-129278
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index ea5a0971ce61..7c93ff020831 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -901,6 +901,13 @@ static int find_and_clear_dst_cluster_bit(struct ploop *ploop,
 	return 0;
 }
 
+static int allocate_cluster(struct ploop *ploop, unsigned int *dst_cluster)
+{
+	if (find_and_clear_dst_cluster_bit(ploop, dst_cluster) < 0)
+		return -EIO;
+	return 0;
+}
+
 /*
  * This finds a free dst_cluster on origin device, and reflects this
  * in ploop->holes_bitmap and bat_page.
@@ -922,7 +929,7 @@ static int ploop_alloc_cluster(struct ploop *ploop, struct ploop_index_wb *piwb,
 		goto unmap;
 	}
 
-	if (find_and_clear_dst_cluster_bit(ploop, dst_cluster) < 0) {
+	if (allocate_cluster(ploop, dst_cluster) < 0) {
 		ret = -EIO;
 		goto unmap;
 	}
@@ -1228,7 +1235,7 @@ static void submit_cluster_write(struct ploop_cow *cow)
 	struct ploop *ploop = cow->ploop;
 	unsigned int dst_cluster;
 
-	if (find_and_clear_dst_cluster_bit(ploop, &dst_cluster) < 0)
+	if (allocate_cluster(ploop, &dst_cluster) < 0)
 		goto error;
 	cow->dst_cluster = dst_cluster;
 


More information about the Devel mailing list