Lines Matching full: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()
789 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
795 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
798 hc = dm_get_mdptr(md); in dm_get_inactive_table()
812 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
817 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
824 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
826 struct gendisk *disk = dm_disk(md); in __dev_status()
833 if (dm_suspended_md(md)) in __dev_status()
836 if (dm_suspended_internally_md(md)) in __dev_status()
839 if (dm_test_deferred_remove_flag(md)) in __dev_status()
849 param->open_count = dm_open_count(md); in __dev_status()
851 param->event_nr = dm_get_event_nr(md); in __dev_status()
854 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
864 dm_put_live_table(md, srcu_idx); in __dev_status()
869 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
875 dm_put_live_table(md, srcu_idx); in __dev_status()
882 struct mapped_device *md; in dev_create() local
891 r = dm_create(m, &md); in dev_create()
895 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
897 dm_put(md); in dev_create()
898 dm_destroy(md); in dev_create()
904 __dev_status(md, param); in dev_create()
906 dm_put(md); in dev_create()
966 struct mapped_device *md = NULL; in find_device() local
971 md = hc->md; in find_device()
974 return md; in find_device()
980 struct mapped_device *md; in dev_remove() local
993 md = hc->md; in dev_remove()
998 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
1002 dm_put(md); in dev_remove()
1007 dm_put(md); in dev_remove()
1015 dm_sync_table(md); in dev_remove()
1021 dm_ima_measure_on_device_remove(md, false); in dev_remove()
1023 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr, false)) in dev_remove()
1026 dm_put(md); in dev_remove()
1027 dm_destroy(md); in dev_remove()
1048 struct mapped_device *md; in dev_rename() local
1064 md = dm_hash_rename(param, new_data); in dev_rename()
1065 if (IS_ERR(md)) in dev_rename()
1066 return PTR_ERR(md); in dev_rename()
1068 __dev_status(md, param); in dev_rename()
1069 dm_put(md); in dev_rename()
1077 struct mapped_device *md; in dev_set_geometry() local
1083 md = find_device(param); in dev_set_geometry()
1084 if (!md) in dev_set_geometry()
1111 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1116 dm_put(md); in dev_set_geometry()
1124 struct mapped_device *md; in do_suspend() local
1126 md = find_device(param); in do_suspend()
1127 if (!md) in do_suspend()
1135 if (!dm_suspended_md(md)) { in do_suspend()
1136 r = dm_suspend(md, suspend_flags); in do_suspend()
1141 __dev_status(md, param); in do_suspend()
1144 dm_put(md); in do_suspend()
1154 struct mapped_device *md; in do_resume() local
1167 md = hc->md; in do_resume()
1184 if (!dm_suspended_md(md)) { in do_resume()
1185 r = dm_suspend(md, suspend_flags); in do_resume()
1188 hc = dm_get_mdptr(md); in do_resume()
1197 dm_sync_table(md); in do_resume()
1200 dm_put(md); in do_resume()
1205 old_size = dm_get_size(md); in do_resume()
1206 old_map = dm_swap_table(md, new_map); in do_resume()
1208 dm_sync_table(md); in do_resume()
1210 dm_put(md); in do_resume()
1213 new_size = dm_get_size(md); in do_resume()
1218 set_disk_ro(dm_disk(md), 0); in do_resume()
1220 set_disk_ro(dm_disk(md), 1); in do_resume()
1223 if (dm_suspended_md(md)) { in do_resume()
1224 r = dm_resume(md); in do_resume()
1226 dm_ima_measure_on_device_resume(md, new_map ? true : false); in do_resume()
1228 if (!dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr, need_resize_uevent)) in do_resume()
1241 __dev_status(md, param); in do_resume()
1243 dm_put(md); in do_resume()
1265 struct mapped_device *md; in dev_status() local
1267 md = find_device(param); in dev_status()
1268 if (!md) in dev_status()
1271 __dev_status(md, param); in dev_status()
1272 dm_put(md); in dev_status()
1359 struct mapped_device *md; in dev_wait() local
1363 md = find_device(param); in dev_wait()
1364 if (!md) in dev_wait()
1370 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1380 __dev_status(md, param); in dev_wait()
1382 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1385 dm_put_live_table(md, srcu_idx); in dev_wait()
1388 dm_put(md); in dev_wait()
1519 struct mapped_device *md; in table_load() local
1522 md = find_device(param); in table_load()
1523 if (!md) in table_load()
1526 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1530 /* Protect md->type and md->queue against concurrent table loads. */ in table_load()
1531 dm_lock_md_type(md); in table_load()
1538 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1548 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1549 /* setup md->queue to reflect md's type (may block) */ in table_load()
1550 r = dm_setup_md_queue(md, t); in table_load()
1555 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1557 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1562 dm_unlock_md_type(md); in table_load()
1566 hc = dm_get_mdptr(md); in table_load()
1580 __dev_status(md, param); in table_load()
1583 dm_sync_table(md); in table_load()
1587 dm_put(md); in table_load()
1592 dm_unlock_md_type(md); in table_load()
1596 dm_put(md); in table_load()
1604 struct mapped_device *md; in table_clear() local
1623 md = hc->md; in table_clear()
1627 __dev_status(md, param); in table_clear()
1630 dm_sync_table(md); in table_clear()
1633 dm_ima_measure_on_table_clear(md, has_new_map); in table_clear()
1634 dm_put(md); in table_clear()
1686 struct mapped_device *md; in table_deps() local
1690 md = find_device(param); in table_deps()
1691 if (!md) in table_deps()
1694 __dev_status(md, param); in table_deps()
1696 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1699 dm_put_live_table(md, srcu_idx); in table_deps()
1701 dm_put(md); in table_deps()
1712 struct mapped_device *md; in table_status() local
1716 md = find_device(param); in table_status()
1717 if (!md) in table_status()
1720 __dev_status(md, param); in table_status()
1722 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1725 dm_put_live_table(md, srcu_idx); in table_status()
1727 dm_put(md); in table_status()
1738 static int message_for_md(struct mapped_device *md, unsigned int argc, char **argv, in message_for_md() argument
1751 return dm_cancel_deferred_remove(md); in message_for_md()
1754 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1769 struct mapped_device *md; in target_message() local
1777 md = find_device(param); in target_message()
1778 if (!md) in target_message()
1800 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1804 table = dm_get_live_table(md, &srcu_idx); in target_message()
1808 if (dm_deleting_md(md)) { in target_message()
1825 dm_put_live_table(md, srcu_idx); in target_message()
1830 __dev_status(md, param); in target_message()
1841 dm_put(md); in target_message()
2218 * @md: Pointer to mapped_device
2222 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2227 if (!md) in dm_copy_name_and_uuid()
2231 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2272 struct mapped_device *md; in dm_early_create() local
2286 r = dm_create(m, &md); in dm_early_create()
2291 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2296 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2317 /* setup md->queue to reflect md's type (may block) */ in dm_early_create()
2318 r = dm_setup_md_queue(md, t); in dm_early_create()
2325 dm_suspend(md, 0); in dm_early_create()
2326 old_map = dm_swap_table(md, t); in dm_early_create()
2331 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2334 r = dm_resume(md); in dm_early_create()
2338 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2339 dm_put(md); in dm_early_create()
2349 dm_put(md); in dm_early_create()
2351 dm_put(md); in dm_early_create()
2352 dm_destroy(md); in dm_early_create()