aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-ioctl.c16
-rw-r--r--drivers/md/dm.c10
-rw-r--r--drivers/md/dm.h2
3 files changed, 16 insertions, 12 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 442e2be6052e..0693b6f54b7d 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -600,12 +600,22 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
600 */ 600 */
601static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) 601static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
602{ 602{
603 struct mapped_device *md;
604 void *mdptr = NULL;
605
603 if (*param->uuid) 606 if (*param->uuid)
604 return __get_uuid_cell(param->uuid); 607 return __get_uuid_cell(param->uuid);
605 else if (*param->name) 608
609 if (*param->name)
606 return __get_name_cell(param->name); 610 return __get_name_cell(param->name);
607 else 611
608 return dm_get_mdptr(huge_decode_dev(param->dev)); 612 md = dm_get_md(huge_decode_dev(param->dev));
613 if (md) {
614 mdptr = dm_get_mdptr(md);
615 dm_put(md);
616 }
617
618 return mdptr;
609} 619}
610 620
611static struct mapped_device *find_device(struct dm_ioctl *param) 621static struct mapped_device *find_device(struct dm_ioctl *param)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f140d499602a..3d121cbc2fde 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -990,15 +990,9 @@ struct mapped_device *dm_get_md(dev_t dev)
990 return md; 990 return md;
991} 991}
992 992
993void *dm_get_mdptr(dev_t dev) 993void *dm_get_mdptr(struct mapped_device *md)
994{ 994{
995 struct mapped_device *md; 995 return md->interface_ptr;
996 void *mdptr = NULL;
997
998 md = dm_find_md(dev);
999 if (md)
1000 mdptr = md->interface_ptr;
1001 return mdptr;
1002} 996}
1003 997
1004void dm_set_mdptr(struct mapped_device *md, void *ptr) 998void dm_set_mdptr(struct mapped_device *md, void *ptr)
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 0ff11d6f8158..17ffa8d671a7 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -47,7 +47,7 @@ struct mapped_device;
47int dm_create(struct mapped_device **md); 47int dm_create(struct mapped_device **md);
48int dm_create_with_minor(unsigned int minor, struct mapped_device **md); 48int dm_create_with_minor(unsigned int minor, struct mapped_device **md);
49void dm_set_mdptr(struct mapped_device *md, void *ptr); 49void dm_set_mdptr(struct mapped_device *md, void *ptr);
50void *dm_get_mdptr(dev_t dev); 50void *dm_get_mdptr(struct mapped_device *md);
51struct mapped_device *dm_get_md(dev_t dev); 51struct mapped_device *dm_get_md(dev_t dev);
52 52
53/* 53/*