[Devel] [PATCH RHEL8 COMMIT] ploop: Introduce {alloc,free}_pio()
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Aug 5 18:32:00 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.2
------>
commit be4812600cb6894bf0595c47cc680719ebbd04c9
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Thu Aug 5 18:32:00 2021 +0300
ploop: Introduce {alloc,free}_pio()
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-cmd.c | 2 +-
drivers/md/dm-ploop-map.c | 8 ++++----
drivers/md/dm-ploop.h | 10 ++++++++++
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index b9be80492eae..d4dc3746ec29 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -613,7 +613,7 @@ static int process_merge_latest_snapshot(struct ploop *ploop)
ret = -EINTR;
break;
}
- pio = kmalloc(sizeof(*pio), GFP_KERNEL);
+ pio = alloc_pio(ploop, GFP_KERNEL);
if (!pio) {
ret = -ENOMEM;
break;
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 5dd2a9ae4866..d60ae5c55edd 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -211,7 +211,7 @@ static void do_pio_endio(struct pio *pio)
endio_cb(pio, endio_cb_data, pio->bi_status);
if (free_on_endio)
- kfree(pio);
+ free_pio(pio->ploop, pio);
}
void pio_endio(struct pio *pio)
@@ -264,7 +264,7 @@ static struct pio * split_and_chain_pio(struct ploop *ploop,
{
struct pio *split;
- split = kmalloc(sizeof(*split), GFP_NOIO);
+ split = alloc_pio(ploop, GFP_NOIO);
if (!split)
return NULL;
@@ -833,7 +833,7 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
static void free_piwb(struct ploop_index_wb *piwb)
{
- kfree(piwb->pio);
+ free_pio(piwb->ploop, piwb->pio);
put_page(piwb->bat_page);
kfree(piwb);
}
@@ -921,7 +921,7 @@ static int ploop_prepare_bat_update(struct ploop *ploop, struct md_page *md,
ploop_index_wb_init(piwb, ploop);
piwb->bat_page = page = alloc_page(GFP_NOIO);
- piwb->pio = pio = kmalloc(sizeof(*pio), GFP_NOIO);
+ piwb->pio = pio = alloc_pio(ploop, GFP_NOIO);
if (!page || !pio)
goto err;
init_pio(ploop, REQ_OP_WRITE, pio);
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index b10820887350..78e361566895 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -547,6 +547,16 @@ static inline bool fake_merge_pio(struct pio *pio)
return false;
}
+static inline struct pio *alloc_pio(struct ploop *ploop, gfp_t flags)
+{
+ return kmalloc(sizeof(struct pio), flags);
+}
+
+static inline void free_pio(struct ploop *ploop, struct pio *pio)
+{
+ kfree(pio);
+}
+
extern void md_page_insert(struct ploop *ploop, struct md_page *md);
extern void ploop_free_md_page(struct md_page *md);
extern void free_md_pages_tree(struct rb_root *root);
More information about the Devel
mailing list