[Devel] [PATCH RHEL8 COMMIT] ploop: Introduce embedded_pio_to_prq()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 2 22:47:59 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.51
------>
commit 1b271587acb6d080b9954222cfcf21ec40c5ab24
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 2 22:47:59 2021 +0300

    ploop: Introduce embedded_pio_to_prq()
    
    ... and rename two functions
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ==========================
    ploop: Split pios in kwork
    
    https://jira.sw.ru/browse/PSBM-131208
    
    Kirill Tkhai (10):
          ploop: Remove debug noinline in create_bvec_from_rq()
          ploop: Manage flush pios in generic way
          ploop: Teach dispatch_pios() work with flush pios
          ploop: Make split_pios_to_list() to add initial pio to the list too
          ploop: Introduce embedded_pio_to_prq()
          ploop: Introduce ploop_prq_valid()
          ploop: Move create_bvec_from_rq() up
          ploop: Split pios from kwork context
          ploop: Add sanity check of passed BAT from disk
          ploop: Reread file size after index update
---
 drivers/md/dm-ploop-map.c |  6 +++---
 drivers/md/dm-ploop.h     | 13 +++++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 692cf1e80936..20f60acd2be3 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -101,7 +101,7 @@ static int ploop_pio_valid(struct ploop *ploop, struct pio *pio)
 	return 0;
 }
 
-static void prq_endio(struct pio *pio, void *prq_ptr, blk_status_t bi_status)
+void prq_endio(struct pio *pio, void *prq_ptr, blk_status_t bi_status)
 {
         struct ploop_rq *prq = prq_ptr;
         struct request *rq = prq->rq;
@@ -1780,10 +1780,10 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
 	struct ploop_rq *prq;
 	struct pio *pio;
 
-	prq = map_info_to_prq(info);
+	prq = map_info_to_embedded_prq(info);
 	init_prq(prq, rq);
 
-	pio = map_info_to_pio(info); /* Embedded pio */
+	pio = map_info_to_embedded_pio(info); /* Embedded pio */
 	init_pio(ploop, req_op(rq), pio);
 
 	if (rq->bio != rq->biotail) {
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 8b5156128889..26eab969c389 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -316,15 +316,24 @@ static inline ssize_t ploop_per_io_data_size(void)
 {
 	return sizeof(struct ploop_rq) + sizeof(struct pio);
 }
-static inline struct ploop_rq *map_info_to_prq(union map_info *info)
+static inline struct ploop_rq *map_info_to_embedded_prq(union map_info *info)
 {
 	return (void *)info->ptr;
 }
-static inline struct pio *map_info_to_pio(union map_info *info)
+static inline struct pio *map_info_to_embedded_pio(union map_info *info)
 {
 	return (void *)info->ptr + sizeof(struct ploop_rq);
 }
 
+extern void prq_endio(struct pio *pio, void *prq_ptr, blk_status_t bi_status);
+
+static inline struct ploop_rq *embedded_pio_to_prq(struct pio *pio)
+{
+	struct ploop_rq *prq = (void *)pio - sizeof(struct ploop_rq);
+	WARN_ON_ONCE(pio->endio_cb != prq_endio);
+	return prq;
+}
+
 #define BAT_LEVEL_MAX		(U8_MAX - 1)
 #define BAT_LEVEL_INVALID	U8_MAX
 static inline u8 top_level(struct ploop *ploop)


More information about the Devel mailing list