[Devel] [PATCH vz9 v1 32/63] dm-ploop: split cow processing into two functions
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Fri Jan 24 18:36:06 MSK 2025
Split ploop_process_delta_cow in two - list iterator and processing
functions, unify handling with other pio types.
We need this to be able to call pio by pio from threads.
https://virtuozzo.atlassian.net/browse/VSTOR-91821
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 52 +++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 24 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 55d619cefe50..4b5992335e04 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1472,39 +1472,43 @@ static void ploop_submit_cow_index_wb(struct ploop_cow *cow)
ploop_complete_cow(cow, BLK_STS_RESOURCE);
}
+static void ploop_process_one_delta_cow(struct ploop *ploop, struct pio *aux_pio)
+{
+ struct ploop_cow *cow;
+
+ cow = aux_pio->endio_cb_data;
+ if (unlikely(aux_pio->bi_status != BLK_STS_OK)) {
+ ploop_complete_cow(cow, aux_pio->bi_status);
+ return;
+ }
+ /* until type is changed */
+ INIT_LIST_HEAD(&aux_pio->list);
+ if (cow->dst_clu == BAT_ENTRY_NONE) {
+ /*
+ * Stage #1: assign dst_clu and write data
+ * to top delta.
+ */
+ ploop_submit_cluster_write(cow);
+ } else {
+ /*
+ * Stage #2: data is written to top delta.
+ * Update index.
+ */
+ ploop_submit_cow_index_wb(cow);
+ }
+}
+
static void ploop_process_delta_cow(struct ploop *ploop,
struct llist_node *cow_llist)
{
- struct ploop_cow *cow;
- struct pio *aux_pio;
struct llist_node *pos, *t;
+ struct pio *aux_pio;
llist_for_each_safe(pos, t, cow_llist) {
aux_pio = list_entry((struct list_head *)pos, typeof(*aux_pio), list);
- cow = aux_pio->endio_cb_data;
- if (unlikely(aux_pio->bi_status != BLK_STS_OK)) {
- ploop_complete_cow(cow, aux_pio->bi_status);
- continue;
- }
- /* until type is changed */
- INIT_LIST_HEAD(&aux_pio->list);
-
- if (cow->dst_clu == BAT_ENTRY_NONE) {
- /*
- * Stage #1: assign dst_clu and write data
- * to top delta.
- */
- ploop_submit_cluster_write(cow);
- } else {
- /*
- * Stage #2: data is written to top delta.
- * Update index.
- */
- ploop_submit_cow_index_wb(cow);
- }
+ ploop_process_one_delta_cow(ploop, aux_pio);
}
}
-
/*
* This allocates a new clu (if clu wb is not pending yet),
* or tries to attach a bio to a planned page index wb.
--
2.43.0
More information about the Devel
mailing list