[PATCH] dm: tidy mdptr
authorAlasdair G Kergon <agk@redhat.com>
Mon, 27 Mar 2006 09:17:53 +0000 (01:17 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:59 +0000 (08:44 -0800)
Change dm_get_mdptr() to take a struct mapped_device instead of 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-ioctl.c
drivers/md/dm.c
drivers/md/dm.h

index 442e2be6052e330f283379b3cc9eb02f7a5855df..0693b6f54b7dd6939488e4c7a44409015735d348 100644 (file)
@@ -600,12 +600,22 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
  */
 static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
 {
+       struct mapped_device *md;
+       void *mdptr = NULL;
+
        if (*param->uuid)
                return __get_uuid_cell(param->uuid);
-       else if (*param->name)
+
+       if (*param->name)
                return __get_name_cell(param->name);
-       else
-               return dm_get_mdptr(huge_decode_dev(param->dev));
+
+       md = dm_get_md(huge_decode_dev(param->dev));
+       if (md) {
+               mdptr = dm_get_mdptr(md);
+               dm_put(md);
+       }
+
+       return mdptr;
 }
 
 static struct mapped_device *find_device(struct dm_ioctl *param)
index f140d499602a14f217a7dfc3d3bd85a6ef828ef7..3d121cbc2fde8f7740e673cc2527abc37030db51 100644 (file)
@@ -990,15 +990,9 @@ struct mapped_device *dm_get_md(dev_t dev)
        return md;
 }
 
-void *dm_get_mdptr(dev_t dev)
+void *dm_get_mdptr(struct mapped_device *md)
 {
-       struct mapped_device *md;
-       void *mdptr = NULL;
-
-       md = dm_find_md(dev);
-       if (md)
-               mdptr = md->interface_ptr;
-       return mdptr;
+       return md->interface_ptr;
 }
 
 void dm_set_mdptr(struct mapped_device *md, void *ptr)
index 0ff11d6f81587d965766a10c173dc72da983deb0..17ffa8d671a70950c42e85c3a20b345bfe210d48 100644 (file)
@@ -47,7 +47,7 @@ struct mapped_device;
 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);
+void *dm_get_mdptr(struct mapped_device *md);
 struct mapped_device *dm_get_md(dev_t dev);
 
 /*