[Devel,rh7,1/2] ms/dm: remove dummy definition of 'struct dm_table'

Submitted by Andrey Ryabinin on Sept. 22, 2016, 4:44 p.m.

Details

Message ID 1474562674-29413-1-git-send-email-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Sept. 22, 2016, 4:44 p.m.
From: Mike Snitzer <snitzer@redhat.com>

Change the map pointer in 'struct mapped_device' from 'struct dm_table
__rcu *' to 'void __rcu *' to avoid the need for the dummy definition.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>

https://jira.sw.ru/browse/PSBM-50727

(cherry picked from commit 1d3aa6f683b1c1a813a63339d7309cff58ba4531)
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 drivers/md/dm.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index d9a24c9..a7993cf 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -129,14 +129,6 @@  EXPORT_SYMBOL_GPL(dm_get_rq_mapinfo);
 #define DMF_SUSPENDED_INTERNALLY 8
 
 /*
- * A dummy definition to make RCU happy.
- * struct dm_table should never be dereferenced in this file.
- */
-struct dm_table {
-	int undefined__;
-};
-
-/*
  * Work processed by per-device workqueue.
  */
 struct mapped_device {
@@ -146,11 +138,11 @@  struct mapped_device {
 	atomic_t open_count;
 
 	/*
-	 * The current mapping.
+	 * The current mapping (struct dm_table *).
 	 * Use dm_get_live_table{_fast} or take suspend_lock for
 	 * dereference.
 	 */
-	struct dm_table __rcu *map;
+	void __rcu *map;
 
 	struct list_head table_devices;
 	struct mutex table_devices_lock;
@@ -2694,7 +2686,7 @@  static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
 	merge_is_optional = dm_table_merge_is_optional(t);
 
 	old_map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
-	rcu_assign_pointer(md->map, t);
+	rcu_assign_pointer(md->map, (void *)t);
 	md->immutable_target_type = dm_table_get_immutable_target_type(t);
 
 	dm_table_set_restrictions(t, q, limits);