[Devel] [PATCH RH8 47/61] ploop: Kill target endio

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 14 18:58:49 MSK 2021


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c    |   21 ++++++++++++---------
 drivers/md/dm-ploop-target.c |    1 -
 drivers/md/dm-ploop.h        |    1 -
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 42ed305a32f0..54ed057b10f3 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -32,6 +32,8 @@
  * become handled in ploop_map() as before.
  */
 
+static int ploop_endio(struct ploop *ploop, struct pio *pio);
+
 #define DM_MSG_PREFIX "ploop"
 
 #define ploop_bat_lock(ploop, exclusive, flags)					\
@@ -127,9 +129,14 @@ static int ploop_pio_cluster(struct ploop *ploop, struct pio *pio,
 static void call_bio_endio(struct pio *pio, void *data, blk_status_t bi_status)
 {
 	struct bio *bio = data;
+	int ret;
+
+	ret = ploop_endio(pio->ploop, pio);
 
-	bio->bi_status = bi_status;
-	bio_endio(bio);
+	if (bi_status)
+		bio->bi_status = bi_status;
+	if (ret == DM_ENDIO_DONE)
+		bio_endio(bio);
 }
 
 void pio_endio(struct pio *pio)
@@ -1680,10 +1687,8 @@ int ploop_map(struct dm_target *ti, struct bio *bio)
 	return DM_MAPIO_SUBMITTED;
 }
 
-int ploop_endio(struct dm_target *ti, struct bio *bio, blk_status_t *err)
+static int ploop_endio(struct ploop *ploop, struct pio *pio)
 {
-	struct pio *pio = bio_to_endio_hook(bio);
-	struct ploop *ploop = ti->private;
 	int ret = DM_ENDIO_DONE;
 
 	if (pio->ref_index != PLOOP_REF_INDEX_INVALID) {
@@ -1696,14 +1701,12 @@ int ploop_endio(struct dm_target *ti, struct bio *bio, blk_status_t *err)
 	}
 	/*
 	 * This function is called from the very beginning
-	 * of bio->bi_end_io (which is dm.c::clone_endio()).
+	 * of call_bio_endio().
 	 *
 	 * DM_ENDIO_DONE return value means handling goes OK.
 	 * DM_ENDIO_INCOMPLETE tells the caller to stop end io
 	 * processing, and that we are going to call bi_end_io
-	 * directly later again. This function (ploop_endio)
-	 * also will be called again then!
-	 * See dm.c::clone_endio() for the details.
+	 * directly later again.
 	 */
 	if (pio->action == PLOOP_END_IO_DATA_BIO)
 		ret = ploop_data_pio_end(pio);
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 1913e836002d..29d2636f12c9 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -426,7 +426,6 @@ static struct target_type ploop_target = {
 	.ctr = ploop_ctr,
 	.dtr = ploop_dtr,
 	.map = ploop_map,
-	.end_io = ploop_endio,
 	.message = ploop_message,
 	.io_hints = ploop_io_hints,
 	.preresume = ploop_preresume,
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 514ab38a8ae2..1b9a7ed8682c 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -518,7 +518,6 @@ extern void do_ploop_fsync_work(struct work_struct *ws);
 extern void process_deferred_cmd(struct ploop *ploop,
 			struct ploop_index_wb *piwb);
 extern int ploop_map(struct dm_target *ti, struct bio *bio);
-extern int ploop_endio(struct dm_target *ti, struct bio *bio, blk_status_t *err);
 extern int ploop_inflight_bios_ref_switch(struct ploop *ploop, bool killable);
 extern struct pio *find_lk_of_cluster(struct ploop *ploop, u32 cluster);
 extern void unlink_postponed_backup_endio(struct ploop *ploop,




More information about the Devel mailing list