commit '4cc96131afce' mentions:
  "DM targets should _never_ include dm-core.h!"

Remove the includes and use helpers like dm_table_get_md
and dm_disk since md->queue = md->disk->queue.

https://virtuozzo.atlassian.net/browse/VSTOR-111632
Signed-off-by: Vasileios Almpanis <vasileios.almpa...@virtuozzo.com>

Feature: make dm-ploop and dm-qcow2 comply with the device-mapper API
---
 drivers/md/dm-ploop-target.c | 7 +++++--
 drivers/md/dm-ploop.h        | 6 +++---
 drivers/md/dm-qcow2.h        | 3 +--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 8b73ec8d7b43..9853db47eda1 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -22,7 +22,6 @@
 #include <linux/timer.h>
 #include <linux/error-injection.h>
 #include "dm-ploop.h"
-#include "dm-core.h"
 
 #define DM_MSG_PREFIX "ploop"
 
@@ -390,7 +389,11 @@ static struct ploop_worker *ploop_worker_create(struct 
ploop *ploop,
 {
        struct ploop_worker *worker;
        struct task_struct *task;
-       int minor = MINOR(disk_devt(ploop->ti->table->md->disk));
+       struct mapped_device *md;
+       int minor;
+
+       md = dm_table_get_md(ploop->ti->table);
+       minor = MINOR(disk_devt(dm_disk(md)));
 
        worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT);
        if (!worker)
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 5a88664feb68..54d51ab8126b 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -10,7 +10,6 @@
 
 #include <linux/device-mapper.h>
 #include <linux/bio.h>
-#include "dm-core.h"
 
 #define PLOOP_MAP_OFFSET 16
 typedef u32 map_index_t;
@@ -271,7 +270,8 @@ struct ploop {
        atomic_t inflight_md;
        struct wait_queue_head inflight_md_wq;
 };
-#define ploop_blk_queue(p) ((p)->ti->table->md->queue)
+
+#define ploop_blk_queue(p) (dm_disk(dm_table_get_md((p)->ti->table))->queue)
 
 struct ploop_rq {
        struct request *rq;
@@ -578,7 +578,7 @@ static inline void ploop_free_pio(struct ploop *ploop, 
struct pio *pio)
 
 static inline const char *ploop_device_name(struct ploop *ploop)
 {
-       return ploop->ti->table->md->disk->disk_name;
+       return dm_disk(dm_table_get_md(ploop->ti->table))->disk_name;
 }
 
 static inline void ploop_add_dirty_for_wb(struct ploop *ploop, struct md_page 
*md)
diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h
index 5aa00c6a5ebd..bdc96f921af9 100644
--- a/drivers/md/dm-qcow2.h
+++ b/drivers/md/dm-qcow2.h
@@ -6,7 +6,6 @@
 #include <linux/device-mapper.h>
 #include <linux/fs.h>
 #include <linux/eventfd.h>
-#include "dm-core.h"
 
 #define DM_MSG_PREFIX "qcow2"
 
@@ -283,7 +282,7 @@ struct qcow2 {
 
 static inline const char *qcow2_device_name(struct dm_target *ti)
 {
-       return ti ? ti->table->md->disk->disk_name : "-";
+       return ti ? dm_disk(dm_table_get_md(ti->table))->disk_name : "-";
 }
 
 #define QCOW2_FMT(fmt) "dm-qcow2: %s: " fmt "\n"
-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to