[Devel] [PATCH RHEL8 COMMIT] ploop: Refactoring in submit_cluster_cow()
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 24 12:57:18 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.31
------>
commit 9551b75cbf7bc492180d9b5c7457de8e1364f51c
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 24 12:57:18 2021 +0300
ploop: Refactoring in submit_cluster_cow()
Move code up and remove duplicate REQ_OP_READ assignment.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=====================
Patchset description:
ploop: Truncate top delta from kernel
and refactoring at tail.
https://jira.sw.ru/browse/PSBM-129278
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 07980d8f73b3..fced934b5b7a 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1176,18 +1176,18 @@ int submit_cluster_cow(struct ploop *ploop, unsigned int level,
unsigned int cluster, unsigned int dst_cluster,
void (*end_fn)(struct ploop *, int, void *), void *data)
{
+ struct ploop_cow *cow = NULL;
struct pio *pio = NULL;
- struct ploop_cow *cow;
/* Prepare new delta read */
pio = alloc_pio_with_pages(ploop);
- if (!pio)
- goto err;
- init_pio(ploop, REQ_OP_READ, pio);
-
cow = kmem_cache_alloc(cow_cache, GFP_NOIO);
- if (!cow)
+ if (!pio || !cow)
goto err;
+ init_pio(ploop, REQ_OP_READ, pio);
+ pio_prepare_offsets(ploop, pio, cluster);
+ pio->endio_cb = ploop_cow_endio;
+ pio->endio_cb_data = cow;
cow->ploop = ploop;
cow->dst_cluster = BAT_ENTRY_NONE;
@@ -1195,11 +1195,6 @@ int submit_cluster_cow(struct ploop *ploop, unsigned int level,
cow->end_fn = end_fn;
cow->data = data;
- pio_prepare_offsets(ploop, pio, cluster);
- pio->bi_op = REQ_OP_READ;
- pio->endio_cb = ploop_cow_endio;
- pio->endio_cb_data = cow;
-
init_pio(ploop, REQ_OP_WRITE, &cow->hook);
add_cluster_lk(ploop, &cow->hook, cluster);
@@ -1209,6 +1204,7 @@ int submit_cluster_cow(struct ploop *ploop, unsigned int level,
err:
if (pio)
free_pio_with_pages(ploop, pio);
+ kfree(cow);
return -ENOMEM;
}
More information about the Devel
mailing list