[Devel] [PATCH RHEL8 COMMIT] ploop: Convert endio_bio_list to endio_list
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 17 19:04:42 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 e6f96cfdd79c3c7e37b8d4334ff0317828bba2a5
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 17 19:04:42 2021 +0300
ploop: Convert endio_bio_list to endio_list
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 | 19 ++++++++++---------
drivers/md/dm-ploop.h | 14 ++++++++++++--
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 8b60d200d729..39dc0a07f19f 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -88,7 +88,7 @@ static void __ploop_init_end_io(struct ploop *ploop, struct pio *pio)
pio->ref_index = PLOOP_REF_INDEX_INVALID;
pio->piwb = NULL;
INIT_LIST_HEAD(&pio->list);
- pio->endio_bio_list = NULL;
+ INIT_LIST_HEAD(&pio->endio_list);
/* FIXME: assign real cluster? */
pio->cluster = UINT_MAX;
RB_CLEAR_NODE(&pio->node);
@@ -245,8 +245,9 @@ struct pio *find_lk_of_cluster(struct ploop *ploop, unsigned int cluster)
static void add_endio_bio(struct pio *h, struct bio *later_bio)
{
- later_bio->bi_next = h->endio_bio_list;
- h->endio_bio_list = later_bio;
+ struct pio *lpio = bio_to_endio_hook(later_bio);
+
+ list_add_tail(&lpio->list, &h->endio_list);
}
static void inc_nr_inflight_raw(struct ploop *ploop, struct pio *h)
@@ -326,22 +327,22 @@ static void link_endio_hook(struct ploop *ploop, struct pio *new, struct rb_root
/*
* Removes endio hook of completed bio either from inflight_bios_rbtree
- * or from exclusive_bios_rbtree. BIOs from endio_bio_list are requeued
+ * or from exclusive_bios_rbtree. BIOs from endio_list are requeued
* to deferred_list.
*/
static void unlink_endio_hook(struct ploop *ploop, struct rb_root *root,
struct pio *h, struct bio_list *bio_list)
{
- struct bio *iter;
+ struct bio *bio;
+ struct pio *pio;
BUG_ON(RB_EMPTY_NODE(&h->node));
rb_erase(&h->node, root);
RB_CLEAR_NODE(&h->node);
- while ((iter = h->endio_bio_list) != NULL) {
- h->endio_bio_list = iter->bi_next;
- iter->bi_next = NULL;
- bio_list_add(bio_list, iter);
+ while ((pio = pio_list_pop(&h->endio_list)) != NULL) {
+ bio = dm_bio_from_per_bio_data(pio, sizeof(struct pio));
+ bio_list_add(bio_list, bio);
}
}
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index a42c9d603df4..421fcc153bd9 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -233,8 +233,8 @@ struct pio {
struct list_head list;
struct rb_node node;
- /* List of bios, which will be queued from this bio end */
- struct bio *endio_bio_list;
+ /* List of pios, which will be queued from this pio end */
+ struct list_head endio_list;
unsigned int cluster;
@@ -489,6 +489,16 @@ static inline struct pio *bio_to_endio_hook(struct bio *bio)
return dm_per_bio_data(bio, sizeof(struct pio));
}
+static inline struct pio *pio_list_pop(struct list_head *pio_list)
+{
+ struct pio *pio;
+
+ pio = list_first_entry_or_null(pio_list, struct pio, list);
+ if (pio)
+ list_del_init(&pio->list);
+ return pio;
+}
+
extern void md_page_insert(struct ploop *ploop, struct md_page *md);
extern void free_md_page(struct md_page *md);
extern void free_md_pages_tree(struct rb_root *root);
More information about the Devel
mailing list