Lines Matching full:md
49 struct mapped_device *md; member
92 dm_get(hc->md); in __get_name_cell()
109 dm_get(hc->md); in __get_uuid_cell()
182 struct mapped_device *md; in __get_dev_cell() local
185 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
186 if (!md) in __get_dev_cell()
189 hc = dm_get_mdptr(md); in __get_dev_cell()
191 dm_put(md); in __get_dev_cell()
202 struct mapped_device *md) in alloc_cell() argument
229 hc->md = md; in alloc_cell()
247 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
254 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
264 dm_put(hc->md); in dm_hash_insert()
274 dm_put(hc->md); in dm_hash_insert()
279 dm_get(md); in dm_hash_insert()
281 dm_set_mdptr(md, cell); in dm_hash_insert()
302 dm_set_mdptr(hc->md, NULL); in __hash_remove()
305 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
308 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
313 dm_put(hc->md); in __hash_remove()
324 struct mapped_device *md; in dm_hash_remove_all() local
334 md = hc->md; in dm_hash_remove_all()
335 dm_get(md); in dm_hash_remove_all()
338 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
339 dm_put(md); in dm_hash_remove_all()
349 dm_sync_table(md); in dm_hash_remove_all()
352 dm_ima_measure_on_device_remove(md, true); in dm_hash_remove_all()
353 dm_put(md); in dm_hash_remove_all()
355 dm_destroy(md); in dm_hash_remove_all()
357 dm_destroy_immediate(md); in dm_hash_remove_all()
415 struct mapped_device *md; in dm_hash_rename() local
441 dm_put(hc->md); in dm_hash_rename()
466 dm_put(hc->md); in dm_hash_rename()
480 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
483 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
485 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
488 md = hc->md; in dm_hash_rename()
490 dm_ima_measure_on_device_rename(md); in dm_hash_rename()
495 return md; in dm_hash_rename()
621 disk = dm_disk(hc->md); in list_devices()
628 event_nr[0] = dm_get_event_nr(hc->md); in list_devices()
765 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
771 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
774 hc = dm_get_mdptr(md); in dm_get_inactive_table()
775 if (!hc || hc->md != md) { in dm_get_inactive_table()
788 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
793 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
800 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
802 struct gendisk *disk = dm_disk(md); in __dev_status()
809 if (dm_suspended_md(md)) in __dev_status()
812 if (dm_suspended_internally_md(md)) in __dev_status()
815 if (dm_test_deferred_remove_flag(md)) in __dev_status()
825 param->open_count = dm_open_count(md); in __dev_status()
827 param->event_nr = dm_get_event_nr(md); in __dev_status()
830 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
840 dm_put_live_table(md, srcu_idx); in __dev_status()
844 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
850 dm_put_live_table(md, srcu_idx); in __dev_status()
857 struct mapped_device *md; in dev_create() local
866 r = dm_create(m, &md); in dev_create()
870 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
872 dm_put(md); in dev_create()
873 dm_destroy(md); in dev_create()
879 __dev_status(md, param); in dev_create()
881 dm_put(md); in dev_create()
941 struct mapped_device *md = NULL; in find_device() local
946 md = hc->md; in find_device()
949 return md; in find_device()
955 struct mapped_device *md; in dev_remove() local
968 md = hc->md; in dev_remove()
973 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
977 dm_put(md); in dev_remove()
982 dm_put(md); in dev_remove()
990 dm_sync_table(md); in dev_remove()
996 dm_ima_measure_on_device_remove(md, false); in dev_remove()
998 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr)) in dev_remove()
1001 dm_put(md); in dev_remove()
1002 dm_destroy(md); in dev_remove()
1023 struct mapped_device *md; in dev_rename() local
1039 md = dm_hash_rename(param, new_data); in dev_rename()
1040 if (IS_ERR(md)) in dev_rename()
1041 return PTR_ERR(md); in dev_rename()
1043 __dev_status(md, param); in dev_rename()
1044 dm_put(md); in dev_rename()
1052 struct mapped_device *md; in dev_set_geometry() local
1058 md = find_device(param); in dev_set_geometry()
1059 if (!md) in dev_set_geometry()
1087 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1092 dm_put(md); in dev_set_geometry()
1100 struct mapped_device *md; in do_suspend() local
1102 md = find_device(param); in do_suspend()
1103 if (!md) in do_suspend()
1111 if (!dm_suspended_md(md)) { in do_suspend()
1112 r = dm_suspend(md, suspend_flags); in do_suspend()
1117 __dev_status(md, param); in do_suspend()
1120 dm_put(md); in do_suspend()
1130 struct mapped_device *md; in do_resume() local
1142 md = hc->md; in do_resume()
1157 if (!dm_suspended_md(md)) in do_resume()
1158 dm_suspend(md, suspend_flags); in do_resume()
1160 old_map = dm_swap_table(md, new_map); in do_resume()
1162 dm_sync_table(md); in do_resume()
1164 dm_put(md); in do_resume()
1169 set_disk_ro(dm_disk(md), 0); in do_resume()
1171 set_disk_ro(dm_disk(md), 1); in do_resume()
1174 if (dm_suspended_md(md)) { in do_resume()
1175 r = dm_resume(md); in do_resume()
1177 dm_ima_measure_on_device_resume(md, new_map ? true : false); in do_resume()
1179 if (!dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr)) in do_resume()
1192 __dev_status(md, param); in do_resume()
1194 dm_put(md); in do_resume()
1216 struct mapped_device *md; in dev_status() local
1218 md = find_device(param); in dev_status()
1219 if (!md) in dev_status()
1222 __dev_status(md, param); in dev_status()
1223 dm_put(md); in dev_status()
1310 struct mapped_device *md; in dev_wait() local
1314 md = find_device(param); in dev_wait()
1315 if (!md) in dev_wait()
1321 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1331 __dev_status(md, param); in dev_wait()
1333 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1336 dm_put_live_table(md, srcu_idx); in dev_wait()
1339 dm_put(md); in dev_wait()
1431 struct mapped_device *md; in table_load() local
1434 md = find_device(param); in table_load()
1435 if (!md) in table_load()
1438 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1442 /* Protect md->type and md->queue against concurrent table loads. */ in table_load()
1443 dm_lock_md_type(md); in table_load()
1450 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1460 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1461 /* setup md->queue to reflect md's type (may block) */ in table_load()
1462 r = dm_setup_md_queue(md, t); in table_load()
1467 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1469 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1474 dm_unlock_md_type(md); in table_load()
1478 hc = dm_get_mdptr(md); in table_load()
1479 if (!hc || hc->md != md) { in table_load()
1492 __dev_status(md, param); in table_load()
1495 dm_sync_table(md); in table_load()
1499 dm_put(md); in table_load()
1504 dm_unlock_md_type(md); in table_load()
1508 dm_put(md); in table_load()
1516 struct mapped_device *md; in table_clear() local
1537 __dev_status(hc->md, param); in table_clear()
1538 md = hc->md; in table_clear()
1541 dm_sync_table(md); in table_clear()
1544 dm_ima_measure_on_table_clear(md, has_new_map); in table_clear()
1545 dm_put(md); in table_clear()
1592 struct mapped_device *md; in table_deps() local
1596 md = find_device(param); in table_deps()
1597 if (!md) in table_deps()
1600 __dev_status(md, param); in table_deps()
1602 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1605 dm_put_live_table(md, srcu_idx); in table_deps()
1607 dm_put(md); in table_deps()
1618 struct mapped_device *md; in table_status() local
1622 md = find_device(param); in table_status()
1623 if (!md) in table_status()
1626 __dev_status(md, param); in table_status()
1628 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1631 dm_put_live_table(md, srcu_idx); in table_status()
1633 dm_put(md); in table_status()
1644 static int message_for_md(struct mapped_device *md, unsigned argc, char **argv, in message_for_md() argument
1657 return dm_cancel_deferred_remove(md); in message_for_md()
1660 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1675 struct mapped_device *md; in target_message() local
1683 md = find_device(param); in target_message()
1684 if (!md) in target_message()
1706 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1710 table = dm_get_live_table(md, &srcu_idx); in target_message()
1714 if (dm_deleting_md(md)) { in target_message()
1731 dm_put_live_table(md, srcu_idx); in target_message()
1736 __dev_status(md, param); in target_message()
1747 dm_put(md); in target_message()
2117 * @md: Pointer to mapped_device
2121 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2126 if (!md) in dm_copy_name_and_uuid()
2130 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2131 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2171 struct mapped_device *md; in dm_early_create() local
2185 r = dm_create(m, &md); in dm_early_create()
2190 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2195 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2216 /* setup md->queue to reflect md's type (may block) */ in dm_early_create()
2217 r = dm_setup_md_queue(md, t); in dm_early_create()
2224 dm_suspend(md, 0); in dm_early_create()
2225 old_map = dm_swap_table(md, t); in dm_early_create()
2230 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2233 r = dm_resume(md); in dm_early_create()
2237 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2238 dm_put(md); in dm_early_create()
2246 dm_put(md); in dm_early_create()
2248 dm_put(md); in dm_early_create()
2249 dm_destroy(md); in dm_early_create()