[Devel] [PATCH RHEL8 COMMIT] ploop: Generalize submit_rw_mapped()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 17 19:01:04 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.44
------>
commit 2515780ac657fc457599b51f15c91b3d92b4c8e9
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jun 17 19:01:04 2021 +0300

    ploop: Generalize submit_rw_mapped()
    
    Add @level argument to be able to use this function
    on any delta.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Allow to resubmit partially completed request
    
    This allows to continue submitting partially completed requests.
    
    https://jira.sw.ru/browse/PSBM-127225
    
    Kirill Tkhai (18):
          ploop: Simplify ploop_write_cluster_sync()
          ploop: Rename hook->pio, h->pio, ploop_cow::hook->aux_pio
          ploop: Rename force_link_inflight_bios
          ploop: Introduce separate lock for inflight pios
          ploop: Use hlist instead of rbtree
          ploop: Always link submitted pios
          ploop: Unexport ploop_inflight_bios_ref_switch()
          ploop: Refactor submit_pio()
          ploop: Introduce ploop_suspend_submitting_pios
          ploop: Refactor ploop_ctr()
          ploop: Use ploop_call_rw_iter() in submit_delta_read()
          ploop: Generalize submit_rw_mapped()
          ploop: Kill submit_delta_read()
          ploop: Rename submit_rw_mapped()
          ploop: Extract submit_rw_mapped() to separate function
          ploop: Save level before submitting pio
          ploop: Make fsync work be able to run in parallel with main work
          ploop: Introduce resubmitting partially completed pios
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-cmd.c |  4 ++--
 drivers/md/dm-ploop-map.c | 12 ++++++++----
 drivers/md/dm-ploop.h     |  2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 392290bb42ea..c15175917ea2 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -217,7 +217,7 @@ static int ploop_read_cluster_sync(struct ploop *ploop, struct pio *pio,
 	pio->endio_cb = wake_completion;
 	pio->endio_cb_data = &completion;
 
-	submit_rw_mapped(ploop, dst_cluster, pio);
+	submit_rw_mapped(ploop, dst_cluster, pio, top_level(ploop));
 	wait_for_completion(&completion);
 
 	if (pio->bi_status)
@@ -243,7 +243,7 @@ static int ploop_write_cluster_sync(struct ploop *ploop, struct pio *pio,
 	pio->endio_cb = wake_completion;
 	pio->endio_cb_data = &completion;
 
-	submit_rw_mapped(ploop, dst_cluster, pio);
+	submit_rw_mapped(ploop, dst_cluster, pio, top_level(ploop));
 	wait_for_completion(&completion);
 
 	if (pio->bi_status)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 54eef62658a4..2525ab2a9c1d 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1015,13 +1015,16 @@ static void data_rw_complete(struct pio *pio)
 	pio_endio(pio);
 }
 
-void submit_rw_mapped(struct ploop *ploop, u32 dst_clu, struct pio *pio)
+void submit_rw_mapped(struct ploop *ploop, u32 dst_clu, struct pio *pio, u8 level)
 {
 	unsigned int rw, nr_segs;
 	struct bio_vec *bvec;
 	struct iov_iter iter;
+	struct file *file;
 	loff_t pos;
 
+	BUG_ON(level > top_level(ploop));
+
 	pio->complete = data_rw_complete;
 
 	rw = (op_is_write(pio->bi_op) ? WRITE : READ);
@@ -1034,7 +1037,8 @@ void submit_rw_mapped(struct ploop *ploop, u32 dst_clu, struct pio *pio)
 	remap_to_cluster(ploop, pio, dst_clu);
 	pos = to_bytes(pio->bi_iter.bi_sector);
 
-	ploop_call_rw_iter(top_delta(ploop)->file, pos, rw, &iter, pio);
+	file = ploop->deltas[level].file;
+	ploop_call_rw_iter(file, pos, rw, &iter, pio);
 }
 
 /*
@@ -1184,7 +1188,7 @@ static void submit_cluster_write(struct ploop_cow *cow)
 	pio->endio_cb = ploop_cow_endio;
 	pio->endio_cb_data = cow;
 
-	submit_rw_mapped(ploop, dst_cluster, pio);
+	submit_rw_mapped(ploop, dst_cluster, pio, top_level(ploop));
 	return;
 error:
 	complete_cow(cow, BLK_STS_IOERR);
@@ -1393,7 +1397,7 @@ static int process_one_deferred_bio(struct ploop *ploop, struct pio *pio,
 queue:
 	link_submitting_pio(ploop, pio, cluster);
 
-	submit_rw_mapped(ploop, dst_cluster, pio);
+	submit_rw_mapped(ploop, dst_cluster, pio, top_level(ploop));
 out:
 	return 0;
 }
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 6fc3777e98cd..12ae7adb5c30 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -495,7 +495,7 @@ extern struct pio *find_lk_of_cluster(struct ploop *ploop, u32 cluster);
 extern void init_pio(struct ploop *ploop, unsigned int bi_op, struct pio *pio);
 extern int ploop_rw_page_sync(unsigned rw, struct file *file,
 			      u64 index, struct page *page);
-extern void submit_rw_mapped(struct ploop *ploop, u32 dst_clu, struct pio *pio);
+extern void submit_rw_mapped(struct ploop *ploop, u32 dst_clu, struct pio *pio, u8 level);
 
 extern int ploop_prepare_reloc_index_wb(struct ploop *, struct ploop_index_wb *,
 					unsigned int, unsigned int *);


More information about the Devel mailing list