[Devel] [PATCH RH8 15/61] ploop: Convert flush_bios

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


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

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 384abbecf0f5..9ce0c2784c44 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1627,18 +1627,20 @@ void do_ploop_work(struct work_struct *ws)
 void do_ploop_fsync_work(struct work_struct *ws)
 {
 	struct ploop *ploop = container_of(ws, struct ploop, fsync_worker);
-	struct bio_list flush_bios = BIO_EMPTY_LIST;
+	LIST_HEAD(flush_pios);
 	struct bio *bio;
+	struct pio *pio;
 
 	spin_lock_irq(&ploop->deferred_lock);
-	bio_list_merge(&flush_bios, &ploop->flush_bios);
-	bio_list_init(&ploop->flush_bios);
+	list_splice_init(&ploop->flush_pios, &flush_pios);
 	spin_unlock_irq(&ploop->deferred_lock);
 
 	/* FIXME: issue flush */
 
-	while ((bio = bio_list_pop(&flush_bios)) != NULL)
+	while ((pio = pio_list_pop(&flush_pios)) != NULL) {
+		bio = dm_bio_from_per_bio_data(pio, sizeof(*pio));
 		bio_endio(bio);
+	}
 }
 
 /*
@@ -1669,7 +1671,7 @@ int ploop_map(struct dm_target *ti, struct bio *bio)
 		return DM_MAPIO_KILL;
 
 	spin_lock_irqsave(&ploop->deferred_lock, flags);
-	bio_list_add(&ploop->flush_bios, bio);
+	list_add_tail(&pio->list, &ploop->flush_pios);
 	spin_unlock_irqrestore(&ploop->deferred_lock, flags);
 	queue_work(ploop->wq, &ploop->fsync_worker);
 
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 8823d59383bf..f2bf9b06dc9b 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -310,7 +310,7 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	spin_lock_init(&ploop->pb_lock);
 
 	INIT_LIST_HEAD(&ploop->deferred_pios);
-	bio_list_init(&ploop->flush_bios);
+	INIT_LIST_HEAD(&ploop->flush_pios);
 	INIT_LIST_HEAD(&ploop->discard_pios);
 	INIT_LIST_HEAD(&ploop->cluster_lk_list);
 	bio_list_init(&ploop->delta_cow_action_list);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 90661296d301..9f2f555d3e4d 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -203,7 +203,7 @@ struct ploop {
 
 	spinlock_t deferred_lock;
 	struct list_head deferred_pios;
-	struct bio_list flush_bios;
+	struct list_head flush_pios;
 	struct list_head discard_pios;
 
 	struct rw_semaphore ctl_rwsem;




More information about the Devel mailing list