[Devel] [PATCH RH8 13/61] ploop: Convert ready_data_pios

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 14 18:55:47 MSK 2021


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c |   14 ++++++++------
 drivers/md/dm-ploop.h     |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 97d237fb085a..6e10c2bd2d90 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -73,7 +73,7 @@ static void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop
 	spin_lock_init(&piwb->lock);
 	piwb->bat_page = NULL;
 	piwb->bi_status = 0;
-	bio_list_init(&piwb->ready_data_bios);
+	INIT_LIST_HEAD(&piwb->ready_data_pios);
 	bio_list_init(&piwb->cow_list);
 	/* For ploop_bat_write_complete() */
 	atomic_set(&piwb->count, 1);
@@ -675,6 +675,7 @@ static void ploop_bat_write_complete(struct ploop_index_wb *piwb,
 	struct bio *data_bio, *cluster_bio;
 	struct ploop *ploop = piwb->ploop;
 	struct ploop_cow *cow;
+	struct pio *data_pio;
 	unsigned long flags;
 
 	if (!bi_status) {
@@ -698,7 +699,8 @@ static void ploop_bat_write_complete(struct ploop_index_wb *piwb,
 	 * End pending data bios. Unlocked, as nobody can
 	 * add a new element after piwc->completed is true.
 	 */
-	while ((data_bio = bio_list_pop(&piwb->ready_data_bios))) {
+	while ((data_pio = pio_list_pop(&piwb->ready_data_pios)) != NULL) {
+		data_bio = dm_bio_from_per_bio_data(data_pio, sizeof(*data_pio));
 		if (bi_status)
 			data_bio->bi_status = bi_status;
 		if (data_bio->bi_end_io)
@@ -848,15 +850,15 @@ static int ploop_alloc_cluster(struct ploop *ploop, struct ploop_index_wb *piwb,
 
 static int ploop_data_bio_end(struct bio *bio)
 {
-	struct pio *h = bio_to_endio_hook(bio);
-	struct ploop_index_wb *piwb = h->piwb;
+	struct pio *pio = bio_to_endio_hook(bio);
+	struct ploop_index_wb *piwb = pio->piwb;
 	unsigned long flags;
 	bool completed;
 
 	spin_lock_irqsave(&piwb->lock, flags);
 	completed = piwb->completed;
 	if (!completed)
-		bio_list_add(&piwb->ready_data_bios, bio);
+		list_add_tail(&pio->list, &piwb->ready_data_pios);
 	else if (!bio->bi_status)
 		bio->bi_status = piwb->bi_status;
 	spin_unlock_irqrestore(&piwb->lock, flags);
@@ -1471,7 +1473,7 @@ static int process_one_discard_bio(struct ploop *ploop, struct bio *bio,
 			ploop_reset_bat_update(piwb);
 	} else {
 		to[cluster] = 0;
-		bio_list_add(&piwb->ready_data_bios, bio);
+		list_add_tail(&h->list, &piwb->ready_data_pios);
 	}
 	kunmap_atomic(to);
 out:
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 6ec1cd1b8d5f..26cf355bfd8b 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -119,7 +119,7 @@ struct ploop_index_wb {
 	enum piwb_type type;
 	spinlock_t lock;
 	struct page *bat_page;
-	struct bio_list ready_data_bios;
+	struct list_head ready_data_pios;
 	struct bio_list cow_list;
 	atomic_t count;
 	bool completed;




More information about the Devel mailing list