[Devel] [RFC PATCH vz9 v6 18/62] dm-ploop: remove extra ploop_cluster_is_in_top_delta()

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Dec 6 00:55:51 MSK 2024


From: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

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 977c58476010..7ecf79fcd2cc 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -607,7 +607,7 @@ static int ploop_zero_range(struct file *file, loff_t pos, loff_t len)
 }
 
 static int 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;
@@ -626,7 +626,7 @@ static int ploop_handle_discard_pio(struct ploop *ploop, struct pio *pio,
 		return 1;
 	}
 
-	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 1;
 	}
@@ -1524,13 +1524,13 @@ 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 */
-		ret = ploop_handle_discard_pio(ploop, pio, clu, dst_clu);
+		ret = ploop_handle_discard_pio(ploop, pio, clu, dst_clu, level);
 		if (ret)
 			goto handled;
 		goto executed;
 	}
 
-	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 handled;
-- 
2.43.0



More information about the Devel mailing list