Lines Matching refs:md
52 struct mapped_device *md; member
99 dm_get(hc->md); in __get_name_cell()
118 dm_get(hc->md); in __get_uuid_cell()
195 struct mapped_device *md; in __get_dev_cell() local
198 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
199 if (!md) in __get_dev_cell()
202 hc = dm_get_mdptr(md); in __get_dev_cell()
204 dm_put(md); in __get_dev_cell()
217 struct mapped_device *md) in alloc_cell() argument
244 hc->md = md; in alloc_cell()
262 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
269 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
279 dm_put(hc->md); in dm_hash_insert()
289 dm_put(hc->md); in dm_hash_insert()
294 dm_get(md); in dm_hash_insert()
296 dm_set_mdptr(md, cell); in dm_hash_insert()
319 dm_set_mdptr(hc->md, NULL); in __hash_remove()
322 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
325 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
330 dm_put(hc->md); in __hash_remove()
341 struct mapped_device *md; in dm_hash_remove_all() local
351 md = hc->md; in dm_hash_remove_all()
352 dm_get(md); in dm_hash_remove_all()
355 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
356 dm_put(md); in dm_hash_remove_all()
366 dm_sync_table(md); in dm_hash_remove_all()
369 dm_ima_measure_on_device_remove(md, true); in dm_hash_remove_all()
370 dm_put(md); in dm_hash_remove_all()
372 dm_destroy(md); in dm_hash_remove_all()
374 dm_destroy_immediate(md); in dm_hash_remove_all()
432 struct mapped_device *md; in dm_hash_rename() local
457 dm_put(hc->md); in dm_hash_rename()
482 dm_put(hc->md); in dm_hash_rename()
496 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
499 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
501 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr, false)) in dm_hash_rename()
504 md = hc->md; in dm_hash_rename()
506 dm_ima_measure_on_device_rename(md); in dm_hash_rename()
511 return md; in dm_hash_rename()
640 disk = dm_disk(hc->md); in list_devices()
647 event_nr[0] = dm_get_event_nr(hc->md); in list_devices()
782 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
788 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
791 hc = dm_get_mdptr(md); in dm_get_inactive_table()
805 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
810 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
817 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
819 struct gendisk *disk = dm_disk(md); in __dev_status()
826 if (dm_suspended_md(md)) in __dev_status()
829 if (dm_suspended_internally_md(md)) in __dev_status()
832 if (dm_test_deferred_remove_flag(md)) in __dev_status()
842 param->open_count = dm_open_count(md); in __dev_status()
844 param->event_nr = dm_get_event_nr(md); in __dev_status()
847 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
857 dm_put_live_table(md, srcu_idx); in __dev_status()
862 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
868 dm_put_live_table(md, srcu_idx); in __dev_status()
875 struct mapped_device *md; in dev_create() local
884 r = dm_create(m, &md); in dev_create()
888 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
890 dm_put(md); in dev_create()
891 dm_destroy(md); in dev_create()
897 __dev_status(md, param); in dev_create()
899 dm_put(md); in dev_create()
959 struct mapped_device *md = NULL; in find_device() local
964 md = hc->md; in find_device()
967 return md; in find_device()
973 struct mapped_device *md; in dev_remove() local
986 md = hc->md; in dev_remove()
991 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
995 dm_put(md); in dev_remove()
1000 dm_put(md); in dev_remove()
1008 dm_sync_table(md); in dev_remove()
1014 dm_ima_measure_on_device_remove(md, false); in dev_remove()
1016 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr, false)) in dev_remove()
1019 dm_put(md); in dev_remove()
1020 dm_destroy(md); in dev_remove()
1041 struct mapped_device *md; in dev_rename() local
1057 md = dm_hash_rename(param, new_data); in dev_rename()
1058 if (IS_ERR(md)) in dev_rename()
1059 return PTR_ERR(md); in dev_rename()
1061 __dev_status(md, param); in dev_rename()
1062 dm_put(md); in dev_rename()
1070 struct mapped_device *md; in dev_set_geometry() local
1076 md = find_device(param); in dev_set_geometry()
1077 if (!md) in dev_set_geometry()
1104 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1109 dm_put(md); in dev_set_geometry()
1117 struct mapped_device *md; in do_suspend() local
1119 md = find_device(param); in do_suspend()
1120 if (!md) in do_suspend()
1128 if (!dm_suspended_md(md)) { in do_suspend()
1129 r = dm_suspend(md, suspend_flags); in do_suspend()
1134 __dev_status(md, param); in do_suspend()
1137 dm_put(md); in do_suspend()
1147 struct mapped_device *md; in do_resume() local
1160 md = hc->md; in do_resume()
1177 if (!dm_suspended_md(md)) in do_resume()
1178 dm_suspend(md, suspend_flags); in do_resume()
1180 old_size = dm_get_size(md); in do_resume()
1181 old_map = dm_swap_table(md, new_map); in do_resume()
1183 dm_sync_table(md); in do_resume()
1185 dm_put(md); in do_resume()
1188 new_size = dm_get_size(md); in do_resume()
1193 set_disk_ro(dm_disk(md), 0); in do_resume()
1195 set_disk_ro(dm_disk(md), 1); in do_resume()
1198 if (dm_suspended_md(md)) { in do_resume()
1199 r = dm_resume(md); in do_resume()
1201 dm_ima_measure_on_device_resume(md, new_map ? true : false); in do_resume()
1203 if (!dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr, need_resize_uevent)) in do_resume()
1216 __dev_status(md, param); in do_resume()
1218 dm_put(md); in do_resume()
1240 struct mapped_device *md; in dev_status() local
1242 md = find_device(param); in dev_status()
1243 if (!md) in dev_status()
1246 __dev_status(md, param); in dev_status()
1247 dm_put(md); in dev_status()
1334 struct mapped_device *md; in dev_wait() local
1338 md = find_device(param); in dev_wait()
1339 if (!md) in dev_wait()
1345 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1355 __dev_status(md, param); in dev_wait()
1357 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1360 dm_put_live_table(md, srcu_idx); in dev_wait()
1363 dm_put(md); in dev_wait()
1455 struct mapped_device *md; in table_load() local
1458 md = find_device(param); in table_load()
1459 if (!md) in table_load()
1462 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1467 dm_lock_md_type(md); in table_load()
1474 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1484 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1486 r = dm_setup_md_queue(md, t); in table_load()
1491 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1493 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1498 dm_unlock_md_type(md); in table_load()
1502 hc = dm_get_mdptr(md); in table_load()
1516 __dev_status(md, param); in table_load()
1519 dm_sync_table(md); in table_load()
1523 dm_put(md); in table_load()
1528 dm_unlock_md_type(md); in table_load()
1532 dm_put(md); in table_load()
1540 struct mapped_device *md; in table_clear() local
1561 __dev_status(hc->md, param); in table_clear()
1562 md = hc->md; in table_clear()
1565 dm_sync_table(md); in table_clear()
1568 dm_ima_measure_on_table_clear(md, has_new_map); in table_clear()
1569 dm_put(md); in table_clear()
1616 struct mapped_device *md; in table_deps() local
1620 md = find_device(param); in table_deps()
1621 if (!md) in table_deps()
1624 __dev_status(md, param); in table_deps()
1626 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1629 dm_put_live_table(md, srcu_idx); in table_deps()
1631 dm_put(md); in table_deps()
1642 struct mapped_device *md; in table_status() local
1646 md = find_device(param); in table_status()
1647 if (!md) in table_status()
1650 __dev_status(md, param); in table_status()
1652 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1655 dm_put_live_table(md, srcu_idx); in table_status()
1657 dm_put(md); in table_status()
1668 static int message_for_md(struct mapped_device *md, unsigned int argc, char **argv, in message_for_md() argument
1681 return dm_cancel_deferred_remove(md); in message_for_md()
1684 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1699 struct mapped_device *md; in target_message() local
1707 md = find_device(param); in target_message()
1708 if (!md) in target_message()
1730 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1734 table = dm_get_live_table(md, &srcu_idx); in target_message()
1738 if (dm_deleting_md(md)) { in target_message()
1755 dm_put_live_table(md, srcu_idx); in target_message()
1760 __dev_status(md, param); in target_message()
1771 dm_put(md); in target_message()
2145 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2150 if (!md) in dm_copy_name_and_uuid()
2154 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2195 struct mapped_device *md; in dm_early_create() local
2209 r = dm_create(m, &md); in dm_early_create()
2214 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2219 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2241 r = dm_setup_md_queue(md, t); in dm_early_create()
2248 dm_suspend(md, 0); in dm_early_create()
2249 old_map = dm_swap_table(md, t); in dm_early_create()
2254 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2257 r = dm_resume(md); in dm_early_create()
2261 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2262 dm_put(md); in dm_early_create()
2272 dm_put(md); in dm_early_create()
2274 dm_put(md); in dm_early_create()
2275 dm_destroy(md); in dm_early_create()