[Devel] [PATCH RH8 07/11] ploop: Move clear bit functionality out of find_and_clear_dst_cluster_bit()

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 21 11:46:40 MSK 2021


...and rename it

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