[Devel] [PATCH RHEL8 COMMIT] ploop: Move clear bit functionality out of find_and_clear_dst_cluster_bit()

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 24 12:57:21 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 681d5c7845503293675b9aeb11e8ade9ea0f2559
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 24 12:57:21 2021 +0300

    ploop: Move clear bit functionality out of find_and_clear_dst_cluster_bit()
    
    ...and rename it
    
    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 | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 7c93ff020831..6504eb6fdfe3 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -879,8 +879,8 @@ static void ploop_bat_page_zero_cluster(struct ploop *ploop,
 	kunmap_atomic(to);
 }
 
-static int find_and_clear_dst_cluster_bit(struct ploop *ploop,
-					  unsigned int *ret_dst_cluster)
+static int find_dst_cluster_bit(struct ploop *ploop,
+		      unsigned int *ret_dst_cluster)
 {
 	unsigned int dst_cluster;
 
@@ -890,21 +890,20 @@ static int find_and_clear_dst_cluster_bit(struct ploop *ploop,
 	dst_cluster = find_first_bit(ploop->holes_bitmap, ploop->hb_nr);
 	if (dst_cluster >= ploop->hb_nr)
 		return -EIO;
-	/*
-	 * Mark cluster as used. Find & clear bit is unlocked,
-	 * since currently this may be called only from deferred
-	 * kwork. Note, that set_bit may be made from many places.
-	 */
-	ploop_hole_clear_bit(dst_cluster, ploop);
-
 	*ret_dst_cluster = dst_cluster;
 	return 0;
 }
 
 static int allocate_cluster(struct ploop *ploop, unsigned int *dst_cluster)
 {
-	if (find_and_clear_dst_cluster_bit(ploop, dst_cluster) < 0)
+	if (find_dst_cluster_bit(ploop, dst_cluster) < 0)
 		return -EIO;
+	/*
+	 * Mark cluster as used. Find & clear bit is unlocked,
+	 * since currently this may be called only from deferred
+	 * kwork. Note, that set_bit may be made from many places.
+	 */
+	ploop_hole_clear_bit(*dst_cluster, ploop);
 	return 0;
 }
 


More information about the Devel mailing list