[Devel] [PATCH RH8 06/11] ploop: Move find_and_clear_dst_cluster_bit() into function
Kirill Tkhai
ktkhai at virtuozzo.com
Fri May 21 11:46:35 MSK 2021
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