[Devel] [PATCH RHEL8 COMMIT] ploop: Kill PLOOP_END_IO_DISCARD_BIO

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 17 19:05:03 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.30
------>
commit 0bfcee3d15dad026b103d82c73e0b02d7b6d5377
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 17 19:05:03 2021 +0300

    ploop: Kill PLOOP_END_IO_DISCARD_BIO
    
    Since there is no loop, we don't have to jump
    to catch discard bio endio.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    dm-ploop: Kill loop
    
    Intermediate patches can't be base for bisect.
    
    In scope of https://jira.sw.ru/browse/PSBM-123654
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 34 +++++++---------------------------
 drivers/md/dm-ploop.h     |  1 -
 2 files changed, 7 insertions(+), 28 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 967122e050f1..ca4a3a154578 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -514,31 +514,21 @@ static void handle_discard_pio(struct ploop *ploop, struct pio *pio,
 		return;
 	}
 
-	pio->action = PLOOP_END_IO_DISCARD_BIO;
 	add_cluster_lk(ploop, pio, cluster);
-
-	read_lock_irq(&ploop->bat_rwlock);
-	inc_nr_inflight(ploop, pio);
-	read_unlock_irq(&ploop->bat_rwlock);
 	atomic_inc(&ploop->nr_discard_bios);
 
 	remap_to_cluster(ploop, pio, dst_cluster);
 
 	pos = to_bytes(pio->bi_iter.bi_sector);
 	ret = punch_hole(top_delta(ploop)->file, pos, pio->bi_iter.bi_size);
-	if (ret)
+	if (ret) {
 		pio->bi_status = errno_to_blk_status(ret);
-	pio_endio(pio);
-}
-
-static int ploop_discard_pio_end(struct ploop *ploop, struct pio *pio)
-{
-	dec_nr_inflight(ploop, pio);
-	if (pio->bi_status == BLK_STS_OK)
-		queue_discard_index_wb(ploop, pio);
-	else
 		pio->action = PLOOP_END_IO_DISCARD_INDEX_BIO;
-	return DM_ENDIO_INCOMPLETE;
+		pio_endio(pio);
+		return;
+	}
+
+	queue_discard_index_wb(ploop, pio);
 }
 
 static int ploop_discard_index_pio_end(struct ploop *ploop, struct pio *pio)
@@ -1516,15 +1506,8 @@ static void process_discard_pios(struct ploop *ploop, struct list_head *pios,
 {
 	struct pio *pio;
 
-	while ((pio = pio_list_pop(pios)) != NULL) {
-
-		if (WARN_ON_ONCE(pio->action != PLOOP_END_IO_DISCARD_BIO)) {
-			pio->bi_status = BLK_STS_IOERR;
-			pio_endio(pio);
-			continue;
-		}
+	while ((pio = pio_list_pop(pios)) != NULL)
 		process_one_discard_pio(ploop, pio, piwb);
-	}
 }
 
 /* Remove from tree bio and endio bio chain */
@@ -1781,9 +1764,6 @@ static int ploop_endio(struct ploop *ploop, struct pio *pio)
 	if (pio->action == PLOOP_END_IO_DATA_BIO)
 		ret = ploop_data_pio_end(pio);
 
-	if (pio->action == PLOOP_END_IO_DISCARD_BIO)
-		ret = ploop_discard_pio_end(ploop, pio);
-
 	if (pio->action == PLOOP_END_IO_DISCARD_INDEX_BIO)
 		ret = ploop_discard_index_pio_end(ploop, pio);
 
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 7579af22a43e..59f706ac8af5 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -258,7 +258,6 @@ struct pio {
 
 #define PLOOP_END_IO_NONE		0
 #define PLOOP_END_IO_DATA_BIO		1
-#define PLOOP_END_IO_DISCARD_BIO	2
 #define PLOOP_END_IO_DISCARD_INDEX_BIO	3
 	unsigned int action:2;
 	/*


More information about the Devel mailing list