]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] device-mapper: add dm_get_md
authorDavid Teigland <teigland@redhat.com>
Fri, 6 Jan 2006 08:20:01 +0000 (00:20 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:34:00 +0000 (08:34 -0800)
Add dm_get_dev() to get a mapped device given its dev_t.

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>
drivers/md/dm.c
drivers/md/dm.h

index 27cd234cf6822686588440ba8727d1b7015e9907..9e8c1edd89dd3386a96827a43c1dd8c5262bca79 100644 (file)
@@ -921,6 +921,16 @@ static struct mapped_device *dm_find_md(dev_t dev)
        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)
 {
        struct mapped_device *md;
index e38c3fc1a1db451aec5b3172b27b22c7042c384c..ab078a249396d4ab72f21a5cec43fc2d48c0b7ea 100644 (file)
@@ -58,6 +58,7 @@ int dm_create(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_get_mdptr(dev_t dev);
+struct mapped_device *dm_get_md(dev_t dev);
 
 /*
  * Reference counting for md.