Add dm_get_dev() to get a mapped device given its dev_t.

From: David Teigland <teigland@redhat.com>
Signed-Off-By: Alasdair G Kergon <agk@redhat.com>

[Submitted upstream 2005/11/18]

Index: linux-2.6.14-rc2/drivers/md/dm.c
===================================================================
--- linux-2.6.14-rc2.orig/drivers/md/dm.c	2005-10-04 18:50:39.000000000 +0100
+++ linux-2.6.14-rc2/drivers/md/dm.c	2005-10-04 19:01:29.000000000 +0100
@@ -921,6 +921,16 @@
 	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: linux-2.6.14-rc2/drivers/md/dm.h
===================================================================
--- linux-2.6.14-rc2.orig/drivers/md/dm.h	2005-09-27 23:01:04.000000000 +0100
+++ linux-2.6.14-rc2/drivers/md/dm.h	2005-10-04 19:01:13.000000000 +0100
@@ -58,6 +58,7 @@
 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.
