aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-ioctl.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 99d38a6925a4..4c350914f4a0 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -128,6 +128,24 @@ static struct hash_cell *__get_uuid_cell(const char *str)
128 return NULL; 128 return NULL;
129} 129}
130 130
131static struct hash_cell *__get_dev_cell(uint64_t dev)
132{
133 struct mapped_device *md;
134 struct hash_cell *hc;
135
136 md = dm_get_md(huge_decode_dev(dev));
137 if (!md)
138 return NULL;
139
140 hc = dm_get_mdptr(md);
141 if (!hc) {
142 dm_put(md);
143 return NULL;
144 }
145
146 return hc;
147}
148
131/*----------------------------------------------------------------- 149/*-----------------------------------------------------------------
132 * Inserting, removing and renaming a device. 150 * Inserting, removing and renaming a device.
133 *---------------------------------------------------------------*/ 151 *---------------------------------------------------------------*/
@@ -718,34 +736,23 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
718 */ 736 */
719static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) 737static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
720{ 738{
721 struct mapped_device *md;
722 struct hash_cell *hc = NULL; 739 struct hash_cell *hc = NULL;
723 740
724 if (*param->uuid) { 741 if (*param->uuid) {
725 hc = __get_uuid_cell(param->uuid); 742 hc = __get_uuid_cell(param->uuid);
726 if (!hc) 743 if (!hc)
727 return NULL; 744 return NULL;
728 goto fill_params; 745 } else if (*param->name) {
729 }
730
731 if (*param->name) {
732 hc = __get_name_cell(param->name); 746 hc = __get_name_cell(param->name);
733 if (!hc) 747 if (!hc)
734 return NULL; 748 return NULL;
735 goto fill_params; 749 } else if (param->dev) {
736 } 750 hc = __get_dev_cell(param->dev);
737 751 if (!hc)
738 md = dm_get_md(huge_decode_dev(param->dev)); 752 return NULL;
739 if (!md) 753 } else
740 return NULL;
741
742 hc = dm_get_mdptr(md);
743 if (!hc) {
744 dm_put(md);
745 return NULL; 754 return NULL;
746 }
747 755
748fill_params:
749 /* 756 /*
750 * Sneakily write in both the name and the uuid 757 * Sneakily write in both the name and the uuid
751 * while we have the cell. 758 * while we have the cell.