Commit d229a958 authored by David Teigland's avatar David Teigland Committed by Linus Torvalds

[PATCH] device-mapper: add dm_get_md

Add dm_get_dev() to get a mapped device given its dev_t.
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 637842cf
...@@ -921,6 +921,16 @@ static struct mapped_device *dm_find_md(dev_t dev) ...@@ -921,6 +921,16 @@ static struct mapped_device *dm_find_md(dev_t dev)
return md; return md;
} }
struct mapped_device *dm_get_md(dev_t dev)
{
struct mapped_device *md = dm_find_md(dev);
if (md)
dm_get(md);
return md;
}
void *dm_get_mdptr(dev_t dev) void *dm_get_mdptr(dev_t dev)
{ {
struct mapped_device *md; struct mapped_device *md;
......
...@@ -58,6 +58,7 @@ int dm_create(struct mapped_device **md); ...@@ -58,6 +58,7 @@ int dm_create(struct mapped_device **md);
int dm_create_with_minor(unsigned int minor, struct mapped_device **md); int dm_create_with_minor(unsigned int minor, struct mapped_device **md);
void dm_set_mdptr(struct mapped_device *md, void *ptr); void dm_set_mdptr(struct mapped_device *md, void *ptr);
void *dm_get_mdptr(dev_t dev); void *dm_get_mdptr(dev_t dev);
struct mapped_device *dm_get_md(dev_t dev);
/* /*
* Reference counting for md. * Reference counting for md.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment