Lines Matching refs:hc
113 struct hash_cell *hc; in __get_name_cell() local
116 list_for_each_entry (hc, _name_buckets + h, name_list) in __get_name_cell()
117 if (!strcmp(hc->name, str)) { in __get_name_cell()
118 dm_get(hc->md); in __get_name_cell()
119 return hc; in __get_name_cell()
127 struct hash_cell *hc; in __get_uuid_cell() local
130 list_for_each_entry (hc, _uuid_buckets + h, uuid_list) in __get_uuid_cell()
131 if (!strcmp(hc->uuid, str)) { in __get_uuid_cell()
132 dm_get(hc->md); in __get_uuid_cell()
133 return hc; in __get_uuid_cell()
142 struct hash_cell *hc; in __get_dev_cell() local
148 hc = dm_get_mdptr(md); in __get_dev_cell()
149 if (!hc) { in __get_dev_cell()
154 return hc; in __get_dev_cell()
163 struct hash_cell *hc; in alloc_cell() local
165 hc = kmalloc(sizeof(*hc), GFP_KERNEL); in alloc_cell()
166 if (!hc) in alloc_cell()
169 hc->name = kstrdup(name, GFP_KERNEL); in alloc_cell()
170 if (!hc->name) { in alloc_cell()
171 kfree(hc); in alloc_cell()
176 hc->uuid = NULL; in alloc_cell()
179 hc->uuid = kstrdup(uuid, GFP_KERNEL); in alloc_cell()
180 if (!hc->uuid) { in alloc_cell()
181 kfree(hc->name); in alloc_cell()
182 kfree(hc); in alloc_cell()
187 INIT_LIST_HEAD(&hc->name_list); in alloc_cell()
188 INIT_LIST_HEAD(&hc->uuid_list); in alloc_cell()
189 hc->md = md; in alloc_cell()
190 hc->new_map = NULL; in alloc_cell()
191 return hc; in alloc_cell()
194 static void free_cell(struct hash_cell *hc) in free_cell() argument
196 if (hc) { in free_cell()
197 kfree(hc->name); in free_cell()
198 kfree(hc->uuid); in free_cell()
199 kfree(hc); in free_cell()
209 struct hash_cell *cell, *hc; in dm_hash_insert() local
222 hc = __get_name_cell(name); in dm_hash_insert()
223 if (hc) { in dm_hash_insert()
224 dm_put(hc->md); in dm_hash_insert()
231 hc = __get_uuid_cell(uuid); in dm_hash_insert()
232 if (hc) { in dm_hash_insert()
234 dm_put(hc->md); in dm_hash_insert()
253 static struct dm_table *__hash_remove(struct hash_cell *hc) in __hash_remove() argument
259 list_del(&hc->uuid_list); in __hash_remove()
260 list_del(&hc->name_list); in __hash_remove()
262 dm_set_mdptr(hc->md, NULL); in __hash_remove()
265 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
268 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
271 if (hc->new_map) in __hash_remove()
272 table = hc->new_map; in __hash_remove()
273 dm_put(hc->md); in __hash_remove()
274 free_cell(hc); in __hash_remove()
282 struct hash_cell *hc; in dm_hash_remove_all() local
292 list_for_each_entry(hc, _name_buckets + i, name_list) { in dm_hash_remove_all()
293 md = hc->md; in dm_hash_remove_all()
303 t = __hash_remove(hc); in dm_hash_remove_all()
336 static void __set_cell_uuid(struct hash_cell *hc, char *new_uuid) in __set_cell_uuid() argument
339 hc->uuid = new_uuid; in __set_cell_uuid()
342 list_add(&hc->uuid_list, _uuid_buckets + hash_str(new_uuid)); in __set_cell_uuid()
349 static char *__change_cell_name(struct hash_cell *hc, char *new_name) in __change_cell_name() argument
356 list_del(&hc->name_list); in __change_cell_name()
357 old_name = hc->name; in __change_cell_name()
360 hc->name = new_name; in __change_cell_name()
363 list_add(&hc->name_list, _name_buckets + hash_str(new_name)); in __change_cell_name()
372 struct hash_cell *hc; in dm_hash_rename() local
391 hc = __get_uuid_cell(new); in dm_hash_rename()
393 hc = __get_name_cell(new); in dm_hash_rename()
395 if (hc) { in dm_hash_rename()
400 dm_put(hc->md); in dm_hash_rename()
409 hc = __get_name_cell(param->name); in dm_hash_rename()
410 if (!hc) { in dm_hash_rename()
421 if (change_uuid && hc->uuid) { in dm_hash_rename()
424 param->name, new, hc->uuid); in dm_hash_rename()
425 dm_put(hc->md); in dm_hash_rename()
432 __set_cell_uuid(hc, new_data); in dm_hash_rename()
434 old_name = __change_cell_name(hc, new_data); in dm_hash_rename()
439 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
442 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
444 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
447 md = hc->md; in dm_hash_rename()
504 struct hash_cell *hc; in list_devices() local
516 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
518 needed += strlen(hc->name) + 1; in list_devices()
539 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
543 disk = dm_disk(hc->md); in list_devices()
546 strcpy(nl->name, hc->name); in list_devices()
549 nl = align_ptr(((void *) ++nl) + strlen(hc->name) + 1); in list_devices()
647 struct hash_cell *hc; in dm_get_inactive_table() local
654 hc = dm_get_mdptr(md); in dm_get_inactive_table()
655 if (!hc || hc->md != md) { in dm_get_inactive_table()
660 table = hc->new_map; in dm_get_inactive_table()
768 struct hash_cell *hc = NULL; in __find_device_hash_cell() local
774 hc = __get_uuid_cell(param->uuid); in __find_device_hash_cell()
775 if (!hc) in __find_device_hash_cell()
781 hc = __get_name_cell(param->name); in __find_device_hash_cell()
782 if (!hc) in __find_device_hash_cell()
785 hc = __get_dev_cell(param->dev); in __find_device_hash_cell()
786 if (!hc) in __find_device_hash_cell()
795 strlcpy(param->name, hc->name, sizeof(param->name)); in __find_device_hash_cell()
796 if (hc->uuid) in __find_device_hash_cell()
797 strlcpy(param->uuid, hc->uuid, sizeof(param->uuid)); in __find_device_hash_cell()
801 if (hc->new_map) in __find_device_hash_cell()
806 return hc; in __find_device_hash_cell()
811 struct hash_cell *hc; in find_device() local
815 hc = __find_device_hash_cell(param); in find_device()
816 if (hc) in find_device()
817 md = hc->md; in find_device()
825 struct hash_cell *hc; in dev_remove() local
831 hc = __find_device_hash_cell(param); in dev_remove()
833 if (!hc) { in dev_remove()
839 md = hc->md; in dev_remove()
851 DMDEBUG_LIMIT("unable to remove open device %s", hc->name); in dev_remove()
857 t = __hash_remove(hc); in dev_remove()
998 struct hash_cell *hc; in do_resume() local
1004 hc = __find_device_hash_cell(param); in do_resume()
1005 if (!hc) { in do_resume()
1011 md = hc->md; in do_resume()
1013 new_map = hc->new_map; in do_resume()
1014 hc->new_map = NULL; in do_resume()
1270 struct hash_cell *hc; in table_load() local
1317 hc = dm_get_mdptr(md); in table_load()
1318 if (!hc || hc->md != md) { in table_load()
1325 if (hc->new_map) in table_load()
1326 old_map = hc->new_map; in table_load()
1327 hc->new_map = t; in table_load()
1354 struct hash_cell *hc; in table_clear() local
1360 hc = __find_device_hash_cell(param); in table_clear()
1361 if (!hc) { in table_clear()
1367 if (hc->new_map) { in table_clear()
1368 old_map = hc->new_map; in table_clear()
1369 hc->new_map = NULL; in table_clear()
1374 __dev_status(hc->md, param); in table_clear()
1375 md = hc->md; in table_clear()
1935 struct hash_cell *hc; in dm_ioctl_export() local
1944 hc = dm_get_mdptr(md); in dm_ioctl_export()
1946 if (hc) { in dm_ioctl_export()
1972 struct hash_cell *hc; in dm_copy_name_and_uuid() local
1978 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
1979 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
1985 strcpy(name, hc->name); in dm_copy_name_and_uuid()
1987 strcpy(uuid, hc->uuid ? : ""); in dm_copy_name_and_uuid()