[PATCH] dm table: store md

Store an up-pointer to the owning struct mapped_device in every table when it
is created.

Access it with:
  struct mapped_device *dm_table_get_md(struct dm_table *t)

Tables linked to md must be destroyed before the md itself.

Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Mike Anderson
2006-03-27 01:17:54 -08:00
committed by Linus Torvalds
parent 9ade92a9a5
commit 1134e5ae79
4 changed files with 40 additions and 17 deletions

View File

@ -1007,18 +1007,18 @@ void dm_get(struct mapped_device *md)
void dm_put(struct mapped_device *md)
{
struct dm_table *map = dm_get_table(md);
struct dm_table *map;
if (atomic_dec_and_test(&md->holders)) {
map = dm_get_table(md);
if (!dm_suspended(md)) {
dm_table_presuspend_targets(map);
dm_table_postsuspend_targets(map);
}
__unbind(md);
dm_table_put(map);
free_dev(md);
}
dm_table_put(map);
}
/*