[Devel] [PATCH RHEL8 COMMIT] ploop: Rename dm_ploop_endio_hook to pio
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 17 19:04:38 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 fac91f3bdb718576886e404075ec750e786d17e6
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 17 19:04:38 2021 +0300
ploop: Rename dm_ploop_endio_hook to pio
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-cmd.c | 8 ++--
drivers/md/dm-ploop-map.c | 91 ++++++++++++++++++++------------------------
drivers/md/dm-ploop-target.c | 2 +-
drivers/md/dm-ploop.h | 17 ++++-----
4 files changed, 54 insertions(+), 64 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 346f69056a11..7060e88675ed 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -1376,9 +1376,9 @@ static int ploop_push_backup_get_uuid(struct ploop *ploop, char *result,
static int ploop_push_backup_read(struct ploop *ploop, char *uuid,
char *result, unsigned int maxlen)
{
- struct dm_ploop_endio_hook *h, *orig_h;
struct push_backup *pb = ploop->pb;
unsigned int left, right, sz = 0;
+ struct pio *h, *orig_h;
struct rb_node *node;
int ret = 1;
@@ -1402,7 +1402,7 @@ static int ploop_push_backup_read(struct ploop *ploop, char *uuid,
left = right = h->cluster;
while ((node = rb_prev(&h->node)) != NULL) {
- h = rb_entry(node, struct dm_ploop_endio_hook, node);
+ h = rb_entry(node, struct pio, node);
if (h->cluster + 1 != left || list_empty(&h->list))
break;
list_del_init(&h->list);
@@ -1411,7 +1411,7 @@ static int ploop_push_backup_read(struct ploop *ploop, char *uuid,
h = orig_h;
while ((node = rb_next(&h->node)) != NULL) {
- h = rb_entry(node, struct dm_ploop_endio_hook, node);
+ h = rb_entry(node, struct pio, node);
if (h->cluster - 1 != right || list_empty(&h->list))
break;
list_del_init(&h->list);
@@ -1429,7 +1429,7 @@ static int ploop_push_backup_write(struct ploop *ploop, char *uuid,
unsigned int i, nr_bat_entries = ploop->nr_bat_entries;
struct bio_list bio_list = BIO_EMPTY_LIST;
struct push_backup *pb = ploop->pb;
- struct dm_ploop_endio_hook *h;
+ struct pio *h;
bool has_more = false;
if (!pb)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 6f1b602117c8..c15e08a2dcd1 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -66,13 +66,12 @@ static void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop
piwb->type = PIWB_TYPE_ALLOC;
}
-static struct dm_ploop_endio_hook *bio_to_endio_hook(struct bio *bio)
+static struct pio *bio_to_endio_hook(struct bio *bio)
{
- return dm_per_bio_data(bio, sizeof(struct dm_ploop_endio_hook));
+ return dm_per_bio_data(bio, sizeof(struct pio));
}
-static void __ploop_init_end_io(struct ploop *ploop,
- struct dm_ploop_endio_hook *pio)
+static void __ploop_init_end_io(struct ploop *ploop, struct pio *pio)
{
pio->action = PLOOP_END_IO_NONE;
pio->ref_index = PLOOP_REF_INDEX_INVALID;
@@ -86,7 +85,7 @@ static void __ploop_init_end_io(struct ploop *ploop,
static void ploop_init_end_io(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *pio = bio_to_endio_hook(bio);
+ struct pio *pio = bio_to_endio_hook(bio);
__ploop_init_end_io(ploop, pio);
}
@@ -196,16 +195,14 @@ static int ploop_map_discard(struct ploop *ploop, struct bio *bio)
return DM_MAPIO_SUBMITTED;
}
-struct dm_ploop_endio_hook *find_endio_hook_range(struct ploop *ploop,
- struct rb_root *root,
- unsigned int left,
- unsigned int right)
+struct pio *find_endio_hook_range(struct ploop *ploop, struct rb_root *root,
+ unsigned int left, unsigned int right)
{
struct rb_node *node = root->rb_node;
- struct dm_ploop_endio_hook *h;
+ struct pio *h;
while (node) {
- h = rb_entry(node, struct dm_ploop_endio_hook, node);
+ h = rb_entry(node, struct pio, node);
if (right < h->cluster)
node = node->rb_left;
else if (left > h->cluster)
@@ -217,28 +214,25 @@ struct dm_ploop_endio_hook *find_endio_hook_range(struct ploop *ploop,
return NULL;
}
-static struct dm_ploop_endio_hook *find_inflight_bio(struct ploop *ploop,
- unsigned int cluster)
+static struct pio *find_inflight_bio(struct ploop *ploop, unsigned int cluster)
{
lockdep_assert_held(&ploop->deferred_lock);
return find_endio_hook(ploop, &ploop->inflight_bios_rbtree, cluster);
}
-struct dm_ploop_endio_hook *find_lk_of_cluster(struct ploop *ploop,
- unsigned int cluster)
+struct pio *find_lk_of_cluster(struct ploop *ploop, unsigned int cluster)
{
lockdep_assert_held(&ploop->deferred_lock);
return find_endio_hook(ploop, &ploop->exclusive_bios_rbtree, cluster);
}
-static void add_endio_bio(struct dm_ploop_endio_hook *h, struct bio *later_bio)
+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;
}
-static void inc_nr_inflight_raw(struct ploop *ploop,
- struct dm_ploop_endio_hook *h)
+static void inc_nr_inflight_raw(struct ploop *ploop, struct pio *h)
{
unsigned char ref_index = ploop->inflight_bios_ref_index;
@@ -250,7 +244,7 @@ static void inc_nr_inflight_raw(struct ploop *ploop,
static void inc_nr_inflight(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
inc_nr_inflight_raw(ploop, h);
}
@@ -265,8 +259,7 @@ static void inc_nr_inflight(struct ploop *ploop, struct bio *bio)
* from ki_complete of requests submitted to delta files
* (while increment occurs just right before the submitting).
*/
-static void dec_nr_inflight_raw(struct ploop *ploop,
- struct dm_ploop_endio_hook *h)
+static void dec_nr_inflight_raw(struct ploop *ploop, struct pio *h)
{
if (h->ref_index != PLOOP_REF_INDEX_INVALID) {
percpu_ref_put(&ploop->inflight_bios_ref[h->ref_index]);
@@ -276,22 +269,22 @@ static void dec_nr_inflight_raw(struct ploop *ploop,
static void dec_nr_inflight(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
dec_nr_inflight_raw(ploop, h);
}
-static void link_endio_hook(struct ploop *ploop, struct dm_ploop_endio_hook *new,
- struct rb_root *root, unsigned int cluster, bool exclusive)
+static void link_endio_hook(struct ploop *ploop, struct pio *new, struct rb_root *root,
+ unsigned int cluster, bool exclusive)
{
struct rb_node *parent, **node = &root->rb_node;
- struct dm_ploop_endio_hook *h;
+ struct pio *h;
BUG_ON(!RB_EMPTY_NODE(&new->node));
parent = NULL;
while (*node) {
- h = rb_entry(*node, struct dm_ploop_endio_hook, node);
+ h = rb_entry(*node, struct pio, node);
parent = *node;
if (cluster < h->cluster)
node = &parent->rb_left;
@@ -320,7 +313,7 @@ static void link_endio_hook(struct ploop *ploop, struct dm_ploop_endio_hook *new
* to deferred_list.
*/
static void unlink_endio_hook(struct ploop *ploop, struct rb_root *root,
- struct dm_ploop_endio_hook *h, struct bio_list *bio_list)
+ struct pio *h, struct bio_list *bio_list)
{
struct bio *iter;
@@ -335,8 +328,7 @@ static void unlink_endio_hook(struct ploop *ploop, struct rb_root *root,
}
}
-static void add_cluster_lk(struct ploop *ploop, struct dm_ploop_endio_hook *h,
- unsigned int cluster)
+static void add_cluster_lk(struct ploop *ploop, struct pio *h, u32 cluster)
{
unsigned long flags;
@@ -344,7 +336,7 @@ static void add_cluster_lk(struct ploop *ploop, struct dm_ploop_endio_hook *h,
link_endio_hook(ploop, h, &ploop->exclusive_bios_rbtree, cluster, true);
spin_unlock_irqrestore(&ploop->deferred_lock, flags);
}
-static void del_cluster_lk(struct ploop *ploop, struct dm_ploop_endio_hook *h)
+static void del_cluster_lk(struct ploop *ploop, struct pio *h)
{
struct bio_list bio_list = BIO_EMPTY_LIST;
unsigned long flags;
@@ -366,7 +358,7 @@ static void del_cluster_lk(struct ploop *ploop, struct dm_ploop_endio_hook *h)
static void maybe_link_submitting_bio(struct ploop *ploop, struct bio *bio,
unsigned int cluster)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
unsigned long flags;
if (!ploop->force_link_inflight_bios)
@@ -378,8 +370,8 @@ static void maybe_link_submitting_bio(struct ploop *ploop, struct bio *bio,
}
static void maybe_unlink_completed_bio(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
struct bio_list bio_list = BIO_EMPTY_LIST;
+ struct pio *h = bio_to_endio_hook(bio);
unsigned long flags;
bool queue = false;
@@ -426,8 +418,8 @@ static bool bio_endio_if_all_zeros(struct bio *bio)
static void handle_discard_bio(struct ploop *ploop, struct bio *bio,
unsigned int cluster, unsigned int dst_cluster)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
- struct dm_ploop_endio_hook *inflight_h;
+ struct pio *h = bio_to_endio_hook(bio);
+ struct pio *inflight_h;
unsigned long flags;
int ret;
@@ -483,7 +475,7 @@ static void handle_discard_bio(struct ploop *ploop, struct bio *bio,
static int ploop_discard_bio_end(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
dec_nr_inflight(ploop, bio);
if (bio->bi_status == BLK_STS_OK)
@@ -495,7 +487,7 @@ static int ploop_discard_bio_end(struct ploop *ploop, struct bio *bio)
static int ploop_discard_index_bio_end(struct ploop *ploop, struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
del_cluster_lk(ploop, h);
@@ -511,8 +503,8 @@ static void complete_cow(struct ploop_cow *cow, blk_status_t bi_status)
unsigned int dst_cluster = cow->dst_cluster;
struct bio *cluster_bio = cow->cluster_bio;
struct ploop *ploop = cow->ploop;
- struct dm_ploop_endio_hook *h;
unsigned long flags;
+ struct pio *h;
WARN_ON_ONCE(cluster_bio->bi_next);
h = &cow->hook;
@@ -851,7 +843,7 @@ static int ploop_alloc_cluster(struct ploop *ploop, struct ploop_index_wb *piwb,
static int ploop_data_bio_end(struct bio *bio)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
struct ploop_index_wb *piwb = h->piwb;
unsigned long flags;
bool completed;
@@ -875,7 +867,7 @@ static int ploop_data_bio_end(struct bio *bio)
static bool ploop_attach_end_action(struct bio *bio, struct ploop_index_wb *piwb)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
if (WARN_ON_ONCE(h->action != PLOOP_END_IO_NONE)) {
h->action = PLOOP_END_IO_NONE;
@@ -915,7 +907,7 @@ static void ploop_read_aio_complete(struct kiocb *iocb, long ret, long ret2)
}
/*
* Read cluster or its part from secondary delta.
- * @bio is dm's or plain (w/o dm_ploop_endio_hook container and ploop_endio()).
+ * @bio is dm's or plain (w/o pio container and ploop_endio()).
* Note, that nr inflight is not incremented here, so delegate this to caller
* (if you need).
*/
@@ -998,7 +990,7 @@ static void ploop_cow_endio(struct bio *cluster_bio)
static bool postpone_if_cluster_locked(struct ploop *ploop, struct bio *bio,
unsigned int cluster)
{
- struct dm_ploop_endio_hook *e_h; /* Exclusively locked */
+ struct pio *e_h; /* Exclusively locked */
spin_lock_irq(&ploop->deferred_lock);
e_h = find_lk_of_cluster(ploop, cluster);
@@ -1014,7 +1006,7 @@ static bool postpone_if_required_for_backup(struct ploop *ploop,
{
struct push_backup *pb = ploop->pb;
bool first, queue_timer = false;
- struct dm_ploop_endio_hook *h;
+ struct pio *h;
if (likely(!pb || !pb->alive))
return false;
@@ -1149,7 +1141,7 @@ static void submit_cluster_write(struct ploop_cow *cow)
static void submit_cow_index_wb(struct ploop_cow *cow,
struct ploop_index_wb *piwb)
{
- struct dm_ploop_endio_hook *h = &cow->hook;
+ struct pio *h = &cow->hook;
unsigned int cluster = h->cluster;
struct ploop *ploop = cow->ploop;
unsigned int page_nr;
@@ -1395,10 +1387,10 @@ static void process_deferred_bios(struct ploop *ploop, struct bio_list *bios,
static int process_one_discard_bio(struct ploop *ploop, struct bio *bio,
struct ploop_index_wb *piwb)
{
- struct dm_ploop_endio_hook *h;
unsigned int page_nr, cluster;
bool bat_update_prepared;
map_index_t *to;
+ struct pio *h;
WARN_ON(ploop->nr_deltas);
@@ -1467,8 +1459,8 @@ static void do_discard_cleanup(struct ploop *ploop)
static void process_discard_bios(struct ploop *ploop, struct bio_list *bios,
struct ploop_index_wb *piwb)
{
- struct dm_ploop_endio_hook *h;
struct bio *bio;
+ struct pio *h;
while ((bio = bio_list_pop(bios))) {
h = bio_to_endio_hook(bio);
@@ -1483,8 +1475,7 @@ static void process_discard_bios(struct ploop *ploop, struct bio_list *bios,
/* Remove from tree bio and endio bio chain */
void unlink_postponed_backup_endio(struct ploop *ploop,
- struct bio_list *bio_list,
- struct dm_ploop_endio_hook *h)
+ struct bio_list *bio_list, struct pio *h)
{
struct push_backup *pb = ploop->pb;
struct bio *bio;
@@ -1504,7 +1495,7 @@ void cleanup_backup(struct ploop *ploop)
{
struct bio_list bio_list = BIO_EMPTY_LIST;
struct push_backup *pb = ploop->pb;
- struct dm_ploop_endio_hook *h;
+ struct pio *h;
struct rb_node *node;
spin_lock_irq(&ploop->pb_lock);
@@ -1514,7 +1505,7 @@ void cleanup_backup(struct ploop *ploop)
write_unlock(&ploop->bat_rwlock);
while ((node = pb->rb_root.rb_node) != NULL) {
- h = rb_entry(node, struct dm_ploop_endio_hook, node);
+ h = rb_entry(node, struct pio, node);
unlink_postponed_backup_endio(ploop, &bio_list, h);
}
spin_unlock_irq(&ploop->pb_lock);
@@ -1643,7 +1634,7 @@ int ploop_map(struct dm_target *ti, struct bio *bio)
int ploop_endio(struct dm_target *ti, struct bio *bio, blk_status_t *err)
{
- struct dm_ploop_endio_hook *h = bio_to_endio_hook(bio);
+ struct pio *h = bio_to_endio_hook(bio);
struct ploop *ploop = ti->private;
int ret = DM_ENDIO_DONE;
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index f8d471581ac0..e9f1eaf51eb0 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -271,7 +271,7 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
if (ret)
goto err;
- ti->per_io_data_size = sizeof(struct dm_ploop_endio_hook);
+ ti->per_io_data_size = sizeof(struct pio);
ti->num_flush_bios = 1;
ti->flush_supported = true;
ti->num_discard_bios = 1;
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 1dfe3dc7df60..53e7060df8e3 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -229,7 +229,7 @@ struct ploop {
spinlock_t pb_lock;
};
-struct dm_ploop_endio_hook {
+struct pio {
struct list_head list;
struct rb_node node;
@@ -265,7 +265,7 @@ struct ploop_cow {
struct bio *cluster_bio;
unsigned int dst_cluster;
- struct dm_ploop_endio_hook hook;
+ struct pio hook;
void (*end_fn)(struct ploop *, int, void *);
void *data; /* Second argument of end_fn */
@@ -456,11 +456,11 @@ static inline void track_bio(struct ploop *ploop, struct bio *bio)
__track_bio(ploop, bio);
}
-extern struct dm_ploop_endio_hook *find_endio_hook_range(struct ploop *ploop,
- struct rb_root *root, unsigned int l, unsigned int r);
+extern struct pio *find_endio_hook_range(struct ploop *ploop, struct rb_root *root,
+ unsigned int l, unsigned int r);
-static inline struct dm_ploop_endio_hook *find_endio_hook(struct ploop *ploop,
- struct rb_root *root, unsigned int cluster)
+static inline struct pio *find_endio_hook(struct ploop *ploop, struct rb_root *root,
+ unsigned int cluster)
{
return find_endio_hook_range(ploop, root, cluster, cluster);
}
@@ -482,11 +482,10 @@ extern void process_deferred_cmd(struct ploop *ploop,
extern int ploop_map(struct dm_target *ti, struct bio *bio);
extern int ploop_endio(struct dm_target *ti, struct bio *bio, blk_status_t *err);
extern int ploop_inflight_bios_ref_switch(struct ploop *ploop, bool killable);
-extern struct dm_ploop_endio_hook *find_lk_of_cluster(struct ploop *ploop,
- unsigned int cluster);
+extern struct pio *find_lk_of_cluster(struct ploop *ploop, u32 cluster);
extern void unlink_postponed_backup_endio(struct ploop *ploop,
struct bio_list *bio_list,
- struct dm_ploop_endio_hook *h);
+ struct pio *h);
extern int ploop_prepare_reloc_index_wb(struct ploop *, struct ploop_index_wb *,
unsigned int, unsigned int *);
More information about the Devel
mailing list