[Devel] [PATCH RHEL8 COMMIT] ploop: Convert flush_bios

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 17 19:04:44 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 1d85c0a9b1bf1eb4789e6621e1f9981dd7d46a26
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 17 19:04:44 2021 +0300

    ploop: Convert flush_bios
    
    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    | 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