[Devel] [PATCH RHEL8 COMMIT] ploop: Convert ready_data_pios
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 17 19:04:43 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 3552cdb678c3f23299ef30640db46a68561ebbf8
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 17 19:04:43 2021 +0300
ploop: Convert ready_data_pios
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 | 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