Lines Matching refs:hc

115 	struct hash_cell *hc;  in __get_name_cell()  local
118 list_for_each_entry (hc, _name_buckets + h, name_list) in __get_name_cell()
119 if (!strcmp(hc->name, str)) { in __get_name_cell()
120 dm_get(hc->md); in __get_name_cell()
121 return hc; in __get_name_cell()
129 struct hash_cell *hc; in __get_uuid_cell() local
132 list_for_each_entry (hc, _uuid_buckets + h, uuid_list) in __get_uuid_cell()
133 if (!strcmp(hc->uuid, str)) { in __get_uuid_cell()
134 dm_get(hc->md); in __get_uuid_cell()
135 return hc; in __get_uuid_cell()
144 struct hash_cell *hc; in __get_dev_cell() local
150 hc = dm_get_mdptr(md); in __get_dev_cell()
151 if (!hc) { in __get_dev_cell()
156 return hc; in __get_dev_cell()
165 struct hash_cell *hc; in alloc_cell() local
167 hc = kmalloc(sizeof(*hc), GFP_KERNEL); in alloc_cell()
168 if (!hc) in alloc_cell()
171 hc->name = kstrdup(name, GFP_KERNEL); in alloc_cell()
172 if (!hc->name) { in alloc_cell()
173 kfree(hc); in alloc_cell()
178 hc->uuid = NULL; in alloc_cell()
181 hc->uuid = kstrdup(uuid, GFP_KERNEL); in alloc_cell()
182 if (!hc->uuid) { in alloc_cell()
183 kfree(hc->name); in alloc_cell()
184 kfree(hc); in alloc_cell()
189 INIT_LIST_HEAD(&hc->name_list); in alloc_cell()
190 INIT_LIST_HEAD(&hc->uuid_list); in alloc_cell()
191 hc->md = md; in alloc_cell()
192 hc->new_map = NULL; in alloc_cell()
193 return hc; in alloc_cell()
196 static void free_cell(struct hash_cell *hc) in free_cell() argument
198 if (hc) { in free_cell()
199 kfree(hc->name); in free_cell()
200 kfree(hc->uuid); in free_cell()
201 kfree(hc); in free_cell()
211 struct hash_cell *cell, *hc; in dm_hash_insert() local
224 hc = __get_name_cell(name); in dm_hash_insert()
225 if (hc) { in dm_hash_insert()
226 dm_put(hc->md); in dm_hash_insert()
233 hc = __get_uuid_cell(uuid); in dm_hash_insert()
234 if (hc) { in dm_hash_insert()
236 dm_put(hc->md); in dm_hash_insert()
255 static struct dm_table *__hash_remove(struct hash_cell *hc) in __hash_remove() argument
261 list_del(&hc->uuid_list); in __hash_remove()
262 list_del(&hc->name_list); in __hash_remove()
264 dm_set_mdptr(hc->md, NULL); in __hash_remove()
267 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
270 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
273 if (hc->new_map) in __hash_remove()
274 table = hc->new_map; in __hash_remove()
275 dm_put(hc->md); in __hash_remove()
276 free_cell(hc); in __hash_remove()
284 struct hash_cell *hc; in dm_hash_remove_all() local
294 list_for_each_entry(hc, _name_buckets + i, name_list) { in dm_hash_remove_all()
295 md = hc->md; in dm_hash_remove_all()
305 t = __hash_remove(hc); in dm_hash_remove_all()
338 static void __set_cell_uuid(struct hash_cell *hc, char *new_uuid) in __set_cell_uuid() argument
341 hc->uuid = new_uuid; in __set_cell_uuid()
344 list_add(&hc->uuid_list, _uuid_buckets + hash_str(new_uuid)); in __set_cell_uuid()
351 static char *__change_cell_name(struct hash_cell *hc, char *new_name) in __change_cell_name() argument
358 list_del(&hc->name_list); in __change_cell_name()
359 old_name = hc->name; in __change_cell_name()
362 hc->name = new_name; in __change_cell_name()
365 list_add(&hc->name_list, _name_buckets + hash_str(new_name)); in __change_cell_name()
374 struct hash_cell *hc; in dm_hash_rename() local
393 hc = __get_uuid_cell(new); in dm_hash_rename()
395 hc = __get_name_cell(new); in dm_hash_rename()
397 if (hc) { in dm_hash_rename()
402 dm_put(hc->md); in dm_hash_rename()
411 hc = __get_name_cell(param->name); in dm_hash_rename()
412 if (!hc) { in dm_hash_rename()
423 if (change_uuid && hc->uuid) { in dm_hash_rename()
426 param->name, new, hc->uuid); in dm_hash_rename()
427 dm_put(hc->md); in dm_hash_rename()
434 __set_cell_uuid(hc, new_data); in dm_hash_rename()
436 old_name = __change_cell_name(hc, new_data); in dm_hash_rename()
441 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
444 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
446 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
449 md = hc->md; in dm_hash_rename()
510 struct hash_cell *hc; in list_devices() local
523 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
524 needed += align_val(offsetof(struct dm_name_list, name) + strlen(hc->name) + 1); in list_devices()
545 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
549 disk = dm_disk(hc->md); in list_devices()
552 strcpy(nl->name, hc->name); in list_devices()
555 event_nr = align_ptr(nl->name + strlen(hc->name) + 1); in list_devices()
556 *event_nr = dm_get_event_nr(hc->md); in list_devices()
685 struct hash_cell *hc; in dm_get_inactive_table() local
692 hc = dm_get_mdptr(md); in dm_get_inactive_table()
693 if (!hc || hc->md != md) { in dm_get_inactive_table()
698 table = hc->new_map; in dm_get_inactive_table()
809 struct hash_cell *hc = NULL; in __find_device_hash_cell() local
815 hc = __get_uuid_cell(param->uuid); in __find_device_hash_cell()
816 if (!hc) in __find_device_hash_cell()
822 hc = __get_name_cell(param->name); in __find_device_hash_cell()
823 if (!hc) in __find_device_hash_cell()
826 hc = __get_dev_cell(param->dev); in __find_device_hash_cell()
827 if (!hc) in __find_device_hash_cell()
836 strlcpy(param->name, hc->name, sizeof(param->name)); in __find_device_hash_cell()
837 if (hc->uuid) in __find_device_hash_cell()
838 strlcpy(param->uuid, hc->uuid, sizeof(param->uuid)); in __find_device_hash_cell()
842 if (hc->new_map) in __find_device_hash_cell()
847 return hc; in __find_device_hash_cell()
852 struct hash_cell *hc; in find_device() local
856 hc = __find_device_hash_cell(param); in find_device()
857 if (hc) in find_device()
858 md = hc->md; in find_device()
866 struct hash_cell *hc; in dev_remove() local
872 hc = __find_device_hash_cell(param); in dev_remove()
874 if (!hc) { in dev_remove()
880 md = hc->md; in dev_remove()
892 DMDEBUG_LIMIT("unable to remove open device %s", hc->name); in dev_remove()
898 t = __hash_remove(hc); in dev_remove()
1039 struct hash_cell *hc; in do_resume() local
1045 hc = __find_device_hash_cell(param); in do_resume()
1046 if (!hc) { in do_resume()
1052 md = hc->md; in do_resume()
1054 new_map = hc->new_map; in do_resume()
1055 hc->new_map = NULL; in do_resume()
1333 struct hash_cell *hc; in table_load() local
1383 hc = dm_get_mdptr(md); in table_load()
1384 if (!hc || hc->md != md) { in table_load()
1391 if (hc->new_map) in table_load()
1392 old_map = hc->new_map; in table_load()
1393 hc->new_map = t; in table_load()
1420 struct hash_cell *hc; in table_clear() local
1426 hc = __find_device_hash_cell(param); in table_clear()
1427 if (!hc) { in table_clear()
1433 if (hc->new_map) { in table_clear()
1434 old_map = hc->new_map; in table_clear()
1435 hc->new_map = NULL; in table_clear()
1440 __dev_status(hc->md, param); in table_clear()
1441 md = hc->md; in table_clear()
2028 struct hash_cell *hc; in dm_copy_name_and_uuid() local
2034 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2035 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2041 strcpy(name, hc->name); in dm_copy_name_and_uuid()
2043 strcpy(uuid, hc->uuid ? : ""); in dm_copy_name_and_uuid()