[Devel] [PATCH VZ9 v3 03/13] dm-ploop: remove extra ploop_cluster_is_in_top_delta()

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 24 20:23:31 MSK 2024


as we already got all info from ploop_bat_entries() earlier.

https://virtuozzo.atlassian.net/browse/VSTOR-91817
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 6765e67db1d9..e5f6e3f3c6b1 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -594,7 +594,7 @@ static int ploop_zero_range(struct file *file, loff_t pos, loff_t len)
 }
 
 static void ploop_handle_discard_pio(struct ploop *ploop, struct pio *pio,
-			       u32 clu, u32 dst_clu)
+			       u32 clu, u32 dst_clu, u8 level)
 {
 	struct pio *inflight_h;
 	unsigned long flags;
@@ -613,7 +613,7 @@ static void ploop_handle_discard_pio(struct ploop *ploop, struct pio *pio,
 		return;
 	}
 
-	if (!ploop_cluster_is_in_top_delta(ploop, clu)) {
+	if (dst_clu == BAT_ENTRY_NONE || level < ploop_top_level(ploop)) {
 		ploop_pio_endio(pio);
 		return;
 	}
@@ -1524,11 +1524,11 @@ static int ploop_process_one_deferred_bio(struct ploop *ploop, struct pio *pio)
 	dst_clu = ploop_bat_entries(ploop, clu, &level, &md);
 	if (op_is_discard(pio->bi_op)) {
 		/* FIXME: check there is no parallel alloc */
-		ploop_handle_discard_pio(ploop, pio, clu, dst_clu);
+		ploop_handle_discard_pio(ploop, pio, clu, dst_clu, level);
 		goto out;
 	}
 
-	if (ploop_cluster_is_in_top_delta(ploop, clu)) {
+	if (!(dst_clu == BAT_ENTRY_NONE || level < ploop_top_level(ploop))) {
 		/* Already mapped */
 		if (ploop_pio_endio_if_merge_fake_pio(pio))
 			goto out;
-- 
2.39.3



More information about the Devel mailing list