[Devel] [PATCH RHEL8 COMMIT] ploop: Save level before submitting pio

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 17 19:01:06 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 00992c7c2e787064282246175fe8283db9087100
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jun 17 19:01:06 2021 +0300

    ploop: Save level before submitting pio
    
    Introduce a new field and place it there.
    
    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-map.c | 11 +++++++----
 drivers/md/dm-ploop.h     |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index debd7f6968f4..4cb4ebe37f6e 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -104,6 +104,7 @@ void init_pio(struct ploop *ploop, unsigned int bi_op, struct pio *pio)
 	INIT_LIST_HEAD(&pio->endio_list);
 	/* FIXME: assign real cluster? */
 	pio->cluster = UINT_MAX;
+	pio->level = BAT_LEVEL_INVALID;
 }
 
 /* Get cluster related to pio sectors */
@@ -1015,7 +1016,7 @@ static void data_rw_complete(struct pio *pio)
 	pio_endio(pio);
 }
 
-static void submit_rw_mapped(struct ploop *ploop, struct pio *pio, u8 level)
+static void submit_rw_mapped(struct ploop *ploop, struct pio *pio)
 {
 	unsigned int rw, nr_segs;
 	struct bio_vec *bvec;
@@ -1023,7 +1024,7 @@ static void submit_rw_mapped(struct ploop *ploop, struct pio *pio, u8 level)
 	struct file *file;
 	loff_t pos;
 
-	BUG_ON(level > top_level(ploop));
+	BUG_ON(pio->level > top_level(ploop));
 
 	pio->complete = data_rw_complete;
 
@@ -1036,14 +1037,16 @@ static void submit_rw_mapped(struct ploop *ploop, struct pio *pio, u8 level)
 
 	pos = to_bytes(pio->bi_iter.bi_sector);
 
-	file = ploop->deltas[level].file;
+	file = ploop->deltas[pio->level].file;
 	ploop_call_rw_iter(file, pos, rw, &iter, pio);
 }
 
 void map_and_submit_rw(struct ploop *ploop, u32 dst_clu, struct pio *pio, u8 level)
 {
 	remap_to_cluster(ploop, pio, dst_clu);
-	submit_rw_mapped(ploop, pio, level);
+	pio->level = level;
+
+	submit_rw_mapped(ploop, pio);
 }
 
 static void initiate_delta_read(struct ploop *ploop, unsigned int level,
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 9039d6ab3c49..533249d8eea8 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -217,6 +217,7 @@ struct pio {
 	void *endio_cb_data;
 
 	unsigned int cluster;
+	u8 level;
 
 	bool is_data_alloc:1;
 	bool wants_discard_index_cleanup:1;
@@ -298,6 +299,7 @@ static inline struct pio *map_info_to_pio(union map_info *info)
 }
 
 #define BAT_LEVEL_MAX		(U8_MAX - 1)
+#define BAT_LEVEL_INVALID	U8_MAX
 static inline u8 top_level(struct ploop *ploop)
 {
 	return ploop->nr_deltas - 1;


More information about the Devel mailing list