[Devel] [PATCH RH8 05/10] ploop: Introduce embedded_pio_to_prq()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Jun 30 19:46:35 MSK 2021
... and rename two functions
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
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