Lines Matching refs:hc
114 struct hash_cell *hc; in __get_name_cell() local
117 list_for_each_entry (hc, _name_buckets + h, name_list) in __get_name_cell()
118 if (!strcmp(hc->name, str)) { in __get_name_cell()
119 dm_get(hc->md); in __get_name_cell()
120 return hc; in __get_name_cell()
128 struct hash_cell *hc; in __get_uuid_cell() local
131 list_for_each_entry (hc, _uuid_buckets + h, uuid_list) in __get_uuid_cell()
132 if (!strcmp(hc->uuid, str)) { in __get_uuid_cell()
133 dm_get(hc->md); in __get_uuid_cell()
134 return hc; in __get_uuid_cell()
143 struct hash_cell *hc; in __get_dev_cell() local
149 hc = dm_get_mdptr(md); in __get_dev_cell()
150 if (!hc) { in __get_dev_cell()
155 return hc; in __get_dev_cell()
164 struct hash_cell *hc; in alloc_cell() local
166 hc = kmalloc(sizeof(*hc), GFP_KERNEL); in alloc_cell()
167 if (!hc) in alloc_cell()
170 hc->name = kstrdup(name, GFP_KERNEL); in alloc_cell()
171 if (!hc->name) { in alloc_cell()
172 kfree(hc); in alloc_cell()
177 hc->uuid = NULL; in alloc_cell()
180 hc->uuid = kstrdup(uuid, GFP_KERNEL); in alloc_cell()
181 if (!hc->uuid) { in alloc_cell()
182 kfree(hc->name); in alloc_cell()
183 kfree(hc); in alloc_cell()
188 INIT_LIST_HEAD(&hc->name_list); in alloc_cell()
189 INIT_LIST_HEAD(&hc->uuid_list); in alloc_cell()
190 hc->md = md; in alloc_cell()
191 hc->new_map = NULL; in alloc_cell()
192 return hc; in alloc_cell()
195 static void free_cell(struct hash_cell *hc) in free_cell() argument
197 if (hc) { in free_cell()
198 kfree(hc->name); in free_cell()
199 kfree(hc->uuid); in free_cell()
200 kfree(hc); in free_cell()
210 struct hash_cell *cell, *hc; in dm_hash_insert() local
223 hc = __get_name_cell(name); in dm_hash_insert()
224 if (hc) { in dm_hash_insert()
225 dm_put(hc->md); in dm_hash_insert()
232 hc = __get_uuid_cell(uuid); in dm_hash_insert()
233 if (hc) { in dm_hash_insert()
235 dm_put(hc->md); in dm_hash_insert()
254 static struct dm_table *__hash_remove(struct hash_cell *hc) in __hash_remove() argument
260 list_del(&hc->uuid_list); in __hash_remove()
261 list_del(&hc->name_list); in __hash_remove()
263 dm_set_mdptr(hc->md, NULL); in __hash_remove()
266 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
269 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
272 if (hc->new_map) in __hash_remove()
273 table = hc->new_map; in __hash_remove()
274 dm_put(hc->md); in __hash_remove()
275 free_cell(hc); in __hash_remove()
283 struct hash_cell *hc; in dm_hash_remove_all() local
293 list_for_each_entry(hc, _name_buckets + i, name_list) { in dm_hash_remove_all()
294 md = hc->md; in dm_hash_remove_all()
304 t = __hash_remove(hc); in dm_hash_remove_all()
337 static void __set_cell_uuid(struct hash_cell *hc, char *new_uuid) in __set_cell_uuid() argument
340 hc->uuid = new_uuid; in __set_cell_uuid()
343 list_add(&hc->uuid_list, _uuid_buckets + hash_str(new_uuid)); in __set_cell_uuid()
350 static char *__change_cell_name(struct hash_cell *hc, char *new_name) in __change_cell_name() argument
357 list_del(&hc->name_list); in __change_cell_name()
358 old_name = hc->name; in __change_cell_name()
361 hc->name = new_name; in __change_cell_name()
364 list_add(&hc->name_list, _name_buckets + hash_str(new_name)); in __change_cell_name()
373 struct hash_cell *hc; in dm_hash_rename() local
392 hc = __get_uuid_cell(new); in dm_hash_rename()
394 hc = __get_name_cell(new); in dm_hash_rename()
396 if (hc) { in dm_hash_rename()
401 dm_put(hc->md); in dm_hash_rename()
410 hc = __get_name_cell(param->name); in dm_hash_rename()
411 if (!hc) { in dm_hash_rename()
422 if (change_uuid && hc->uuid) { in dm_hash_rename()
425 param->name, new, hc->uuid); in dm_hash_rename()
426 dm_put(hc->md); in dm_hash_rename()
433 __set_cell_uuid(hc, new_data); in dm_hash_rename()
435 old_name = __change_cell_name(hc, new_data); in dm_hash_rename()
440 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
443 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
445 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
448 md = hc->md; in dm_hash_rename()
509 struct hash_cell *hc; in list_devices() local
522 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
523 needed += align_val(offsetof(struct dm_name_list, name) + strlen(hc->name) + 1); in list_devices()
544 list_for_each_entry (hc, _name_buckets + i, name_list) { in list_devices()
548 disk = dm_disk(hc->md); in list_devices()
551 strcpy(nl->name, hc->name); in list_devices()
554 event_nr = align_ptr(nl->name + strlen(hc->name) + 1); in list_devices()
555 *event_nr = dm_get_event_nr(hc->md); in list_devices()
684 struct hash_cell *hc; in dm_get_inactive_table() local
691 hc = dm_get_mdptr(md); in dm_get_inactive_table()
692 if (!hc || hc->md != md) { in dm_get_inactive_table()
697 table = hc->new_map; in dm_get_inactive_table()
808 struct hash_cell *hc = NULL; in __find_device_hash_cell() local
814 hc = __get_uuid_cell(param->uuid); in __find_device_hash_cell()
815 if (!hc) in __find_device_hash_cell()
821 hc = __get_name_cell(param->name); in __find_device_hash_cell()
822 if (!hc) in __find_device_hash_cell()
825 hc = __get_dev_cell(param->dev); in __find_device_hash_cell()
826 if (!hc) in __find_device_hash_cell()
835 strlcpy(param->name, hc->name, sizeof(param->name)); in __find_device_hash_cell()
836 if (hc->uuid) in __find_device_hash_cell()
837 strlcpy(param->uuid, hc->uuid, sizeof(param->uuid)); in __find_device_hash_cell()
841 if (hc->new_map) in __find_device_hash_cell()
846 return hc; in __find_device_hash_cell()
851 struct hash_cell *hc; in find_device() local
855 hc = __find_device_hash_cell(param); in find_device()
856 if (hc) in find_device()
857 md = hc->md; in find_device()
865 struct hash_cell *hc; in dev_remove() local
871 hc = __find_device_hash_cell(param); in dev_remove()
873 if (!hc) { in dev_remove()
879 md = hc->md; in dev_remove()
891 DMDEBUG_LIMIT("unable to remove open device %s", hc->name); in dev_remove()
897 t = __hash_remove(hc); in dev_remove()
1038 struct hash_cell *hc; in do_resume() local
1044 hc = __find_device_hash_cell(param); in do_resume()
1045 if (!hc) { in do_resume()
1051 md = hc->md; in do_resume()
1053 new_map = hc->new_map; in do_resume()
1054 hc->new_map = NULL; in do_resume()
1332 struct hash_cell *hc; in table_load() local
1382 hc = dm_get_mdptr(md); in table_load()
1383 if (!hc || hc->md != md) { in table_load()
1390 if (hc->new_map) in table_load()
1391 old_map = hc->new_map; in table_load()
1392 hc->new_map = t; in table_load()
1419 struct hash_cell *hc; in table_clear() local
1425 hc = __find_device_hash_cell(param); in table_clear()
1426 if (!hc) { in table_clear()
1432 if (hc->new_map) { in table_clear()
1433 old_map = hc->new_map; in table_clear()
1434 hc->new_map = NULL; in table_clear()
1439 __dev_status(hc->md, param); in table_clear()
1440 md = hc->md; in table_clear()
2026 struct hash_cell *hc; in dm_copy_name_and_uuid() local
2032 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2033 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2039 strcpy(name, hc->name); in dm_copy_name_and_uuid()
2041 strcpy(uuid, hc->uuid ? : ""); in dm_copy_name_and_uuid()