Lines Matching refs:md
44 struct mapped_device *md; member
119 dm_get(hc->md); in __get_name_cell()
133 dm_get(hc->md); in __get_uuid_cell()
142 struct mapped_device *md; in __get_dev_cell() local
145 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
146 if (!md) in __get_dev_cell()
149 hc = dm_get_mdptr(md); in __get_dev_cell()
151 dm_put(md); in __get_dev_cell()
162 struct mapped_device *md) in alloc_cell() argument
190 hc->md = md; in alloc_cell()
208 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
215 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
225 dm_put(hc->md); in dm_hash_insert()
235 dm_put(hc->md); in dm_hash_insert()
240 dm_get(md); in dm_hash_insert()
242 dm_set_mdptr(md, cell); in dm_hash_insert()
263 dm_set_mdptr(hc->md, NULL); in __hash_remove()
266 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
269 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
274 dm_put(hc->md); in __hash_remove()
284 struct mapped_device *md; in dm_hash_remove_all() local
294 md = hc->md; in dm_hash_remove_all()
295 dm_get(md); in dm_hash_remove_all()
298 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
299 dm_put(md); in dm_hash_remove_all()
309 dm_sync_table(md); in dm_hash_remove_all()
312 dm_put(md); in dm_hash_remove_all()
314 dm_destroy(md); in dm_hash_remove_all()
316 dm_destroy_immediate(md); in dm_hash_remove_all()
375 struct mapped_device *md; in dm_hash_rename() local
401 dm_put(hc->md); in dm_hash_rename()
426 dm_put(hc->md); in dm_hash_rename()
440 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
443 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
445 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
448 md = hc->md; in dm_hash_rename()
452 return md; in dm_hash_rename()
548 disk = dm_disk(hc->md); in list_devices()
555 *event_nr = dm_get_event_nr(hc->md); in list_devices()
682 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
688 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
691 hc = dm_get_mdptr(md); in dm_get_inactive_table()
692 if (!hc || hc->md != md) { in dm_get_inactive_table()
705 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
710 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
717 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
719 struct gendisk *disk = dm_disk(md); in __dev_status()
726 if (dm_suspended_md(md)) in __dev_status()
729 if (dm_suspended_internally_md(md)) in __dev_status()
732 if (dm_test_deferred_remove_flag(md)) in __dev_status()
742 param->open_count = dm_open_count(md); in __dev_status()
744 param->event_nr = dm_get_event_nr(md); in __dev_status()
747 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
757 dm_put_live_table(md, srcu_idx); in __dev_status()
761 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
767 dm_put_live_table(md, srcu_idx); in __dev_status()
774 struct mapped_device *md; in dev_create() local
783 r = dm_create(m, &md); in dev_create()
787 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
789 dm_put(md); in dev_create()
790 dm_destroy(md); in dev_create()
796 __dev_status(md, param); in dev_create()
798 dm_put(md); in dev_create()
852 struct mapped_device *md = NULL; in find_device() local
857 md = hc->md; in find_device()
860 return md; in find_device()
866 struct mapped_device *md; in dev_remove() local
879 md = hc->md; in dev_remove()
884 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
888 dm_put(md); in dev_remove()
893 dm_put(md); in dev_remove()
901 dm_sync_table(md); in dev_remove()
907 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr)) in dev_remove()
910 dm_put(md); in dev_remove()
911 dm_destroy(md); in dev_remove()
932 struct mapped_device *md; in dev_rename() local
948 md = dm_hash_rename(param, new_data); in dev_rename()
949 if (IS_ERR(md)) in dev_rename()
950 return PTR_ERR(md); in dev_rename()
952 __dev_status(md, param); in dev_rename()
953 dm_put(md); in dev_rename()
961 struct mapped_device *md; in dev_set_geometry() local
967 md = find_device(param); in dev_set_geometry()
968 if (!md) in dev_set_geometry()
996 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1001 dm_put(md); in dev_set_geometry()
1009 struct mapped_device *md; in do_suspend() local
1011 md = find_device(param); in do_suspend()
1012 if (!md) in do_suspend()
1020 if (!dm_suspended_md(md)) { in do_suspend()
1021 r = dm_suspend(md, suspend_flags); in do_suspend()
1026 __dev_status(md, param); in do_suspend()
1029 dm_put(md); in do_suspend()
1039 struct mapped_device *md; in do_resume() local
1051 md = hc->md; in do_resume()
1066 if (!dm_suspended_md(md)) in do_resume()
1067 dm_suspend(md, suspend_flags); in do_resume()
1069 old_map = dm_swap_table(md, new_map); in do_resume()
1071 dm_sync_table(md); in do_resume()
1073 dm_put(md); in do_resume()
1078 set_disk_ro(dm_disk(md), 0); in do_resume()
1080 set_disk_ro(dm_disk(md), 1); in do_resume()
1083 if (dm_suspended_md(md)) { in do_resume()
1084 r = dm_resume(md); in do_resume()
1085 if (!r && !dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr)) in do_resume()
1097 __dev_status(md, param); in do_resume()
1099 dm_put(md); in do_resume()
1121 struct mapped_device *md; in dev_status() local
1123 md = find_device(param); in dev_status()
1124 if (!md) in dev_status()
1127 __dev_status(md, param); in dev_status()
1128 dm_put(md); in dev_status()
1213 struct mapped_device *md; in dev_wait() local
1217 md = find_device(param); in dev_wait()
1218 if (!md) in dev_wait()
1224 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1234 __dev_status(md, param); in dev_wait()
1236 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1239 dm_put_live_table(md, srcu_idx); in dev_wait()
1242 dm_put(md); in dev_wait()
1334 struct mapped_device *md; in table_load() local
1337 md = find_device(param); in table_load()
1338 if (!md) in table_load()
1341 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1346 dm_lock_md_type(md); in table_load()
1351 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1361 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1363 dm_set_md_type(md, dm_table_get_type(t)); in table_load()
1366 r = dm_setup_md_queue(md, t); in table_load()
1371 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1373 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1378 dm_unlock_md_type(md); in table_load()
1382 hc = dm_get_mdptr(md); in table_load()
1383 if (!hc || hc->md != md) { in table_load()
1396 __dev_status(md, param); in table_load()
1399 dm_sync_table(md); in table_load()
1403 dm_put(md); in table_load()
1408 dm_unlock_md_type(md); in table_load()
1412 dm_put(md); in table_load()
1420 struct mapped_device *md; in table_clear() local
1439 __dev_status(hc->md, param); in table_clear()
1440 md = hc->md; in table_clear()
1443 dm_sync_table(md); in table_clear()
1446 dm_put(md); in table_clear()
1493 struct mapped_device *md; in table_deps() local
1497 md = find_device(param); in table_deps()
1498 if (!md) in table_deps()
1501 __dev_status(md, param); in table_deps()
1503 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1506 dm_put_live_table(md, srcu_idx); in table_deps()
1508 dm_put(md); in table_deps()
1519 struct mapped_device *md; in table_status() local
1523 md = find_device(param); in table_status()
1524 if (!md) in table_status()
1527 __dev_status(md, param); in table_status()
1529 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1532 dm_put_live_table(md, srcu_idx); in table_status()
1534 dm_put(md); in table_status()
1545 static int message_for_md(struct mapped_device *md, unsigned argc, char **argv, in message_for_md() argument
1558 return dm_cancel_deferred_remove(md); in message_for_md()
1561 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1576 struct mapped_device *md; in target_message() local
1584 md = find_device(param); in target_message()
1585 if (!md) in target_message()
1607 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1611 table = dm_get_live_table(md, &srcu_idx); in target_message()
1615 if (dm_deleting_md(md)) { in target_message()
1632 dm_put_live_table(md, srcu_idx); in target_message()
1637 __dev_status(md, param); in target_message()
1648 dm_put(md); in target_message()
2023 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2028 if (!md) in dm_copy_name_and_uuid()
2032 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2033 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2073 struct mapped_device *md; in dm_early_create() local
2087 r = dm_create(m, &md); in dm_early_create()
2092 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2097 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2118 md->type = dm_table_get_type(t); in dm_early_create()
2120 r = dm_setup_md_queue(md, t); in dm_early_create()
2127 dm_suspend(md, 0); in dm_early_create()
2128 old_map = dm_swap_table(md, t); in dm_early_create()
2133 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2136 r = dm_resume(md); in dm_early_create()
2140 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2141 dm_put(md); in dm_early_create()
2149 dm_put(md); in dm_early_create()
2151 dm_put(md); in dm_early_create()
2152 dm_destroy(md); in dm_early_create()