[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:
committed by
Linus Torvalds
parent
9ade92a9a5
commit
1134e5ae79
@@ -22,6 +22,7 @@
|
||||
#define CHILDREN_PER_NODE (KEYS_PER_NODE + 1)
|
||||
|
||||
struct dm_table {
|
||||
struct mapped_device *md;
|
||||
atomic_t holders;
|
||||
|
||||
/* btree table */
|
||||
@@ -206,7 +207,8 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dm_table_create(struct dm_table **result, int mode, unsigned num_targets)
|
||||
int dm_table_create(struct dm_table **result, int mode,
|
||||
unsigned num_targets, struct mapped_device *md)
|
||||
{
|
||||
struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL);
|
||||
|
||||
@@ -229,6 +231,7 @@ int dm_table_create(struct dm_table **result, int mode, unsigned num_targets)
|
||||
}
|
||||
|
||||
t->mode = mode;
|
||||
t->md = md;
|
||||
*result = t;
|
||||
return 0;
|
||||
}
|
||||
@@ -952,12 +955,20 @@ int dm_table_flush_all(struct dm_table *t)
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct mapped_device *dm_table_get_md(struct dm_table *t)
|
||||
{
|
||||
dm_get(t->md);
|
||||
|
||||
return t->md;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(dm_vcalloc);
|
||||
EXPORT_SYMBOL(dm_get_device);
|
||||
EXPORT_SYMBOL(dm_put_device);
|
||||
EXPORT_SYMBOL(dm_table_event);
|
||||
EXPORT_SYMBOL(dm_table_get_size);
|
||||
EXPORT_SYMBOL(dm_table_get_mode);
|
||||
EXPORT_SYMBOL(dm_table_get_md);
|
||||
EXPORT_SYMBOL(dm_table_put);
|
||||
EXPORT_SYMBOL(dm_table_get);
|
||||
EXPORT_SYMBOL(dm_table_unplug_all);
|
||||
|
Reference in New Issue
Block a user