Lines Matching refs:md
48 struct mapped_device *md; member
91 dm_get(hc->md); in __get_name_cell()
108 dm_get(hc->md); in __get_uuid_cell()
181 struct mapped_device *md; in __get_dev_cell() local
184 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
185 if (!md) in __get_dev_cell()
188 hc = dm_get_mdptr(md); in __get_dev_cell()
190 dm_put(md); in __get_dev_cell()
201 struct mapped_device *md) in alloc_cell() argument
228 hc->md = md; in alloc_cell()
246 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
253 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
263 dm_put(hc->md); in dm_hash_insert()
273 dm_put(hc->md); in dm_hash_insert()
278 dm_get(md); in dm_hash_insert()
280 dm_set_mdptr(md, cell); in dm_hash_insert()
301 dm_set_mdptr(hc->md, NULL); in __hash_remove()
304 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
307 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
312 dm_put(hc->md); in __hash_remove()
323 struct mapped_device *md; in dm_hash_remove_all() local
333 md = hc->md; in dm_hash_remove_all()
334 dm_get(md); in dm_hash_remove_all()
337 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
338 dm_put(md); in dm_hash_remove_all()
348 dm_sync_table(md); in dm_hash_remove_all()
351 dm_ima_measure_on_device_remove(md, true); in dm_hash_remove_all()
352 dm_put(md); in dm_hash_remove_all()
354 dm_destroy(md); in dm_hash_remove_all()
356 dm_destroy_immediate(md); in dm_hash_remove_all()
414 struct mapped_device *md; in dm_hash_rename() local
440 dm_put(hc->md); in dm_hash_rename()
465 dm_put(hc->md); in dm_hash_rename()
479 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
482 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
484 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
487 md = hc->md; in dm_hash_rename()
489 dm_ima_measure_on_device_rename(md); in dm_hash_rename()
494 return md; in dm_hash_rename()
620 disk = dm_disk(hc->md); in list_devices()
627 event_nr[0] = dm_get_event_nr(hc->md); in list_devices()
764 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
770 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
773 hc = dm_get_mdptr(md); in dm_get_inactive_table()
774 if (!hc || hc->md != md) { in dm_get_inactive_table()
787 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
792 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
799 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
801 struct gendisk *disk = dm_disk(md); in __dev_status()
808 if (dm_suspended_md(md)) in __dev_status()
811 if (dm_suspended_internally_md(md)) in __dev_status()
814 if (dm_test_deferred_remove_flag(md)) in __dev_status()
824 param->open_count = dm_open_count(md); in __dev_status()
826 param->event_nr = dm_get_event_nr(md); in __dev_status()
829 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
839 dm_put_live_table(md, srcu_idx); in __dev_status()
843 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
849 dm_put_live_table(md, srcu_idx); in __dev_status()
856 struct mapped_device *md; in dev_create() local
865 r = dm_create(m, &md); in dev_create()
869 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
871 dm_put(md); in dev_create()
872 dm_destroy(md); in dev_create()
878 __dev_status(md, param); in dev_create()
880 dm_put(md); in dev_create()
934 struct mapped_device *md = NULL; in find_device() local
939 md = hc->md; in find_device()
942 return md; in find_device()
948 struct mapped_device *md; in dev_remove() local
961 md = hc->md; in dev_remove()
966 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
970 dm_put(md); in dev_remove()
975 dm_put(md); in dev_remove()
983 dm_sync_table(md); in dev_remove()
989 dm_ima_measure_on_device_remove(md, false); in dev_remove()
991 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr)) in dev_remove()
994 dm_put(md); in dev_remove()
995 dm_destroy(md); in dev_remove()
1016 struct mapped_device *md; in dev_rename() local
1032 md = dm_hash_rename(param, new_data); in dev_rename()
1033 if (IS_ERR(md)) in dev_rename()
1034 return PTR_ERR(md); in dev_rename()
1036 __dev_status(md, param); in dev_rename()
1037 dm_put(md); in dev_rename()
1045 struct mapped_device *md; in dev_set_geometry() local
1051 md = find_device(param); in dev_set_geometry()
1052 if (!md) in dev_set_geometry()
1080 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1085 dm_put(md); in dev_set_geometry()
1093 struct mapped_device *md; in do_suspend() local
1095 md = find_device(param); in do_suspend()
1096 if (!md) in do_suspend()
1104 if (!dm_suspended_md(md)) { in do_suspend()
1105 r = dm_suspend(md, suspend_flags); in do_suspend()
1110 __dev_status(md, param); in do_suspend()
1113 dm_put(md); in do_suspend()
1123 struct mapped_device *md; in do_resume() local
1135 md = hc->md; in do_resume()
1150 if (!dm_suspended_md(md)) in do_resume()
1151 dm_suspend(md, suspend_flags); in do_resume()
1153 old_map = dm_swap_table(md, new_map); in do_resume()
1155 dm_sync_table(md); in do_resume()
1157 dm_put(md); in do_resume()
1162 set_disk_ro(dm_disk(md), 0); in do_resume()
1164 set_disk_ro(dm_disk(md), 1); in do_resume()
1167 if (dm_suspended_md(md)) { in do_resume()
1168 r = dm_resume(md); in do_resume()
1170 dm_ima_measure_on_device_resume(md, new_map ? true : false); in do_resume()
1172 if (!dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr)) in do_resume()
1185 __dev_status(md, param); in do_resume()
1187 dm_put(md); in do_resume()
1209 struct mapped_device *md; in dev_status() local
1211 md = find_device(param); in dev_status()
1212 if (!md) in dev_status()
1215 __dev_status(md, param); in dev_status()
1216 dm_put(md); in dev_status()
1303 struct mapped_device *md; in dev_wait() local
1307 md = find_device(param); in dev_wait()
1308 if (!md) in dev_wait()
1314 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1324 __dev_status(md, param); in dev_wait()
1326 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1329 dm_put_live_table(md, srcu_idx); in dev_wait()
1332 dm_put(md); in dev_wait()
1424 struct mapped_device *md; in table_load() local
1427 md = find_device(param); in table_load()
1428 if (!md) in table_load()
1431 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1436 dm_lock_md_type(md); in table_load()
1443 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1453 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1455 r = dm_setup_md_queue(md, t); in table_load()
1460 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1462 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1467 dm_unlock_md_type(md); in table_load()
1471 hc = dm_get_mdptr(md); in table_load()
1472 if (!hc || hc->md != md) { in table_load()
1485 __dev_status(md, param); in table_load()
1488 dm_sync_table(md); in table_load()
1492 dm_put(md); in table_load()
1497 dm_unlock_md_type(md); in table_load()
1501 dm_put(md); in table_load()
1509 struct mapped_device *md; in table_clear() local
1530 __dev_status(hc->md, param); in table_clear()
1531 md = hc->md; in table_clear()
1534 dm_sync_table(md); in table_clear()
1537 dm_ima_measure_on_table_clear(md, has_new_map); in table_clear()
1538 dm_put(md); in table_clear()
1585 struct mapped_device *md; in table_deps() local
1589 md = find_device(param); in table_deps()
1590 if (!md) in table_deps()
1593 __dev_status(md, param); in table_deps()
1595 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1598 dm_put_live_table(md, srcu_idx); in table_deps()
1600 dm_put(md); in table_deps()
1611 struct mapped_device *md; in table_status() local
1615 md = find_device(param); in table_status()
1616 if (!md) in table_status()
1619 __dev_status(md, param); in table_status()
1621 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1624 dm_put_live_table(md, srcu_idx); in table_status()
1626 dm_put(md); in table_status()
1637 static int message_for_md(struct mapped_device *md, unsigned argc, char **argv, in message_for_md() argument
1650 return dm_cancel_deferred_remove(md); in message_for_md()
1653 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1668 struct mapped_device *md; in target_message() local
1676 md = find_device(param); in target_message()
1677 if (!md) in target_message()
1699 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1703 table = dm_get_live_table(md, &srcu_idx); in target_message()
1707 if (dm_deleting_md(md)) { in target_message()
1724 dm_put_live_table(md, srcu_idx); in target_message()
1729 __dev_status(md, param); in target_message()
1740 dm_put(md); in target_message()
2110 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2115 if (!md) in dm_copy_name_and_uuid()
2119 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2120 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2160 struct mapped_device *md; in dm_early_create() local
2174 r = dm_create(m, &md); in dm_early_create()
2179 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2184 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2206 r = dm_setup_md_queue(md, t); in dm_early_create()
2213 dm_suspend(md, 0); in dm_early_create()
2214 old_map = dm_swap_table(md, t); in dm_early_create()
2219 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2222 r = dm_resume(md); in dm_early_create()
2226 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2227 dm_put(md); in dm_early_create()
2235 dm_put(md); in dm_early_create()
2237 dm_put(md); in dm_early_create()
2238 dm_destroy(md); in dm_early_create()