Lines Matching refs:md
35 struct mapped_device *md; member
118 dm_get(hc->md); in __get_name_cell()
132 dm_get(hc->md); in __get_uuid_cell()
141 struct mapped_device *md; in __get_dev_cell() local
144 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
145 if (!md) in __get_dev_cell()
148 hc = dm_get_mdptr(md); in __get_dev_cell()
150 dm_put(md); in __get_dev_cell()
161 struct mapped_device *md) in alloc_cell() argument
189 hc->md = md; in alloc_cell()
207 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
214 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
224 dm_put(hc->md); in dm_hash_insert()
234 dm_put(hc->md); in dm_hash_insert()
239 dm_get(md); in dm_hash_insert()
241 dm_set_mdptr(md, cell); in dm_hash_insert()
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()
273 dm_put(hc->md); in __hash_remove()
283 struct mapped_device *md; in dm_hash_remove_all() local
293 md = hc->md; in dm_hash_remove_all()
294 dm_get(md); in dm_hash_remove_all()
297 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
298 dm_put(md); in dm_hash_remove_all()
308 dm_sync_table(md); in dm_hash_remove_all()
311 dm_put(md); in dm_hash_remove_all()
313 dm_destroy(md); in dm_hash_remove_all()
315 dm_destroy_immediate(md); in dm_hash_remove_all()
374 struct mapped_device *md; in dm_hash_rename() local
400 dm_put(hc->md); in dm_hash_rename()
425 dm_put(hc->md); 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()
451 return md; in dm_hash_rename()
543 disk = dm_disk(hc->md); in list_devices()
645 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
651 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
654 hc = dm_get_mdptr(md); in dm_get_inactive_table()
655 if (!hc || hc->md != md) { in dm_get_inactive_table()
668 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
673 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
680 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
682 struct gendisk *disk = dm_disk(md); in __dev_status()
689 if (dm_suspended_md(md)) in __dev_status()
692 if (dm_suspended_internally_md(md)) in __dev_status()
695 if (dm_test_deferred_remove_flag(md)) in __dev_status()
705 param->open_count = dm_open_count(md); in __dev_status()
707 param->event_nr = dm_get_event_nr(md); in __dev_status()
710 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
720 dm_put_live_table(md, srcu_idx); in __dev_status()
724 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
730 dm_put_live_table(md, srcu_idx); in __dev_status()
737 struct mapped_device *md; in dev_create() local
746 r = dm_create(m, &md); in dev_create()
750 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
752 dm_put(md); in dev_create()
753 dm_destroy(md); in dev_create()
759 __dev_status(md, param); in dev_create()
761 dm_put(md); in dev_create()
815 struct mapped_device *md = NULL; in find_device() local
820 md = hc->md; in find_device()
823 return md; in find_device()
829 struct mapped_device *md; in dev_remove() local
842 md = hc->md; in dev_remove()
847 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
851 dm_put(md); in dev_remove()
856 dm_put(md); in dev_remove()
864 dm_sync_table(md); in dev_remove()
870 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr)) in dev_remove()
873 dm_put(md); in dev_remove()
874 dm_destroy(md); in dev_remove()
895 struct mapped_device *md; in dev_rename() local
911 md = dm_hash_rename(param, new_data); in dev_rename()
912 if (IS_ERR(md)) in dev_rename()
913 return PTR_ERR(md); in dev_rename()
915 __dev_status(md, param); in dev_rename()
916 dm_put(md); in dev_rename()
924 struct mapped_device *md; in dev_set_geometry() local
930 md = find_device(param); in dev_set_geometry()
931 if (!md) in dev_set_geometry()
959 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
964 dm_put(md); in dev_set_geometry()
972 struct mapped_device *md; in do_suspend() local
974 md = find_device(param); in do_suspend()
975 if (!md) in do_suspend()
983 if (!dm_suspended_md(md)) { in do_suspend()
984 r = dm_suspend(md, suspend_flags); in do_suspend()
989 __dev_status(md, param); in do_suspend()
992 dm_put(md); in do_suspend()
1002 struct mapped_device *md; in do_resume() local
1014 md = hc->md; in do_resume()
1029 if (!dm_suspended_md(md)) in do_resume()
1030 dm_suspend(md, suspend_flags); in do_resume()
1032 old_map = dm_swap_table(md, new_map); in do_resume()
1034 dm_sync_table(md); in do_resume()
1036 dm_put(md); in do_resume()
1041 set_disk_ro(dm_disk(md), 0); in do_resume()
1043 set_disk_ro(dm_disk(md), 1); in do_resume()
1046 if (dm_suspended_md(md)) { in do_resume()
1047 r = dm_resume(md); in do_resume()
1048 if (!r && !dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr)) in do_resume()
1060 __dev_status(md, param); in do_resume()
1062 dm_put(md); in do_resume()
1084 struct mapped_device *md; in dev_status() local
1086 md = find_device(param); in dev_status()
1087 if (!md) in dev_status()
1090 __dev_status(md, param); in dev_status()
1091 dm_put(md); in dev_status()
1176 struct mapped_device *md; in dev_wait() local
1180 md = find_device(param); in dev_wait()
1181 if (!md) in dev_wait()
1187 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1197 __dev_status(md, param); in dev_wait()
1199 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1202 dm_put_live_table(md, srcu_idx); in dev_wait()
1205 dm_put(md); in dev_wait()
1275 struct mapped_device *md; in table_load() local
1278 md = find_device(param); in table_load()
1279 if (!md) in table_load()
1282 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1287 dm_lock_md_type(md); in table_load()
1292 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1301 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1303 dm_set_md_type(md, dm_table_get_type(t)); in table_load()
1306 r = dm_setup_md_queue(md); in table_load()
1311 } else if (dm_get_md_type(md) != dm_table_get_type(t)) { in table_load()
1317 dm_unlock_md_type(md); in table_load()
1321 hc = dm_get_mdptr(md); in table_load()
1322 if (!hc || hc->md != md) { in table_load()
1335 __dev_status(md, param); in table_load()
1338 dm_sync_table(md); in table_load()
1342 dm_put(md); in table_load()
1347 dm_unlock_md_type(md); in table_load()
1351 dm_put(md); in table_load()
1359 struct mapped_device *md; in table_clear() local
1378 __dev_status(hc->md, param); in table_clear()
1379 md = hc->md; in table_clear()
1382 dm_sync_table(md); in table_clear()
1385 dm_put(md); in table_clear()
1432 struct mapped_device *md; in table_deps() local
1436 md = find_device(param); in table_deps()
1437 if (!md) in table_deps()
1440 __dev_status(md, param); in table_deps()
1442 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1445 dm_put_live_table(md, srcu_idx); in table_deps()
1447 dm_put(md); in table_deps()
1458 struct mapped_device *md; in table_status() local
1462 md = find_device(param); in table_status()
1463 if (!md) in table_status()
1466 __dev_status(md, param); in table_status()
1468 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1471 dm_put_live_table(md, srcu_idx); in table_status()
1473 dm_put(md); in table_status()
1484 static int message_for_md(struct mapped_device *md, unsigned argc, char **argv, in message_for_md() argument
1497 return dm_cancel_deferred_remove(md); in message_for_md()
1500 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1515 struct mapped_device *md; in target_message() local
1523 md = find_device(param); in target_message()
1524 if (!md) in target_message()
1545 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1549 table = dm_get_live_table(md, &srcu_idx); in target_message()
1553 if (dm_deleting_md(md)) { in target_message()
1570 dm_put_live_table(md, srcu_idx); in target_message()
1575 __dev_status(md, param); in target_message()
1586 dm_put(md); in target_message()
1934 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
1939 if (!md) in dm_copy_name_and_uuid()
1943 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
1944 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()