[Devel] [PATCH RHEL8 COMMIT] ploop: Convert add_endio_bio()
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 17 19:04:45 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 c5b19cb47446de940bd7178b4569286e9ca18452
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 17 19:04:45 2021 +0300
ploop: Convert add_endio_bio()
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 | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 03ee782c044e..6ce7027f0648 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -254,11 +254,9 @@ struct pio *find_lk_of_cluster(struct ploop *ploop, unsigned int cluster)
return find_endio_hook(ploop, &ploop->exclusive_bios_rbtree, cluster);
}
-static void add_endio_bio(struct pio *h, struct bio *later_bio)
+static void add_endio_pio(struct pio *head, struct pio *pio)
{
- struct pio *lpio = bio_to_endio_hook(later_bio);
-
- list_add_tail(&lpio->list, &h->endio_list);
+ list_add_tail(&pio->list, &head->endio_list);
}
static void inc_nr_inflight_raw(struct ploop *ploop, struct pio *h)
@@ -481,7 +479,7 @@ static void handle_discard_bio(struct ploop *ploop, struct bio *bio,
spin_lock_irqsave(&ploop->deferred_lock, flags);
inflight_h = find_inflight_bio(ploop, cluster);
if (inflight_h)
- add_endio_bio(inflight_h, bio);
+ add_endio_pio(inflight_h, h);
spin_unlock_irqrestore(&ploop->deferred_lock, flags);
if (inflight_h) {
@@ -1003,7 +1001,7 @@ static void ploop_cow_endio(struct bio *cluster_bio)
queue_work(ploop->wq, &ploop->worker);
}
-static bool postpone_if_cluster_locked(struct ploop *ploop, struct bio *bio,
+static bool postpone_if_cluster_locked(struct ploop *ploop, struct pio *pio,
unsigned int cluster)
{
struct pio *e_h; /* Exclusively locked */
@@ -1011,14 +1009,14 @@ static bool postpone_if_cluster_locked(struct ploop *ploop, struct bio *bio,
spin_lock_irq(&ploop->deferred_lock);
e_h = find_lk_of_cluster(ploop, cluster);
if (e_h)
- add_endio_bio(e_h, bio);
+ add_endio_pio(e_h, pio);
spin_unlock_irq(&ploop->deferred_lock);
return e_h != NULL;
}
static bool postpone_if_required_for_backup(struct ploop *ploop,
- struct bio *bio, unsigned int cluster)
+ struct pio *pio, unsigned int cluster)
{
struct push_backup *pb = ploop->pb;
bool first, queue_timer = false;
@@ -1026,7 +1024,7 @@ static bool postpone_if_required_for_backup(struct ploop *ploop,
if (likely(!pb || !pb->alive))
return false;
- if (!op_is_write(bio->bi_opf))
+ if (!op_is_write(pio->bi_opf))
return false;
if (!test_bit(cluster, pb->ppb_map))
return false;
@@ -1038,7 +1036,7 @@ static bool postpone_if_required_for_backup(struct ploop *ploop,
h = find_endio_hook(ploop, &pb->rb_root, cluster);
if (h) {
- add_endio_bio(h, bio);
+ add_endio_pio(h, pio);
spin_unlock_irq(&ploop->pb_lock);
return true;
}
@@ -1048,10 +1046,9 @@ static bool postpone_if_required_for_backup(struct ploop *ploop,
queue_timer = true;
}
- h = bio_to_endio_hook(bio);
- link_endio_hook(ploop, h, &pb->rb_root, cluster, true);
+ link_endio_hook(ploop, pio, &pb->rb_root, cluster, true);
first = list_empty(&pb->pending);
- list_add_tail(&h->list, &pb->pending);
+ list_add_tail(&pio->list, &pb->pending);
spin_unlock_irq(&ploop->pb_lock);
if (first)
@@ -1350,9 +1347,9 @@ static int process_one_deferred_bio(struct ploop *ploop, struct bio *bio,
cluster = sector >> ploop->cluster_log;
dst_cluster = ploop_bat_entries(ploop, cluster, &level);
- if (postpone_if_cluster_locked(ploop, bio, cluster))
+ if (postpone_if_cluster_locked(ploop, pio, cluster))
goto out;
- if (postpone_if_required_for_backup(ploop, bio, cluster))
+ if (postpone_if_required_for_backup(ploop, pio, cluster))
goto out;
if (op_is_discard(bio->bi_opf)) {
More information about the Devel
mailing list