Lines Matching full:md
45 struct mapped_device *md; member
120 dm_get(hc->md); in __get_name_cell()
134 dm_get(hc->md); in __get_uuid_cell()
143 struct mapped_device *md; in __get_dev_cell() local
146 md = dm_get_md(huge_decode_dev(dev)); in __get_dev_cell()
147 if (!md) in __get_dev_cell()
150 hc = dm_get_mdptr(md); in __get_dev_cell()
152 dm_put(md); in __get_dev_cell()
163 struct mapped_device *md) in alloc_cell() argument
191 hc->md = md; in alloc_cell()
209 static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md) in dm_hash_insert() argument
216 cell = alloc_cell(name, uuid, md); in dm_hash_insert()
226 dm_put(hc->md); in dm_hash_insert()
236 dm_put(hc->md); in dm_hash_insert()
241 dm_get(md); in dm_hash_insert()
243 dm_set_mdptr(md, cell); in dm_hash_insert()
264 dm_set_mdptr(hc->md, NULL); in __hash_remove()
267 table = dm_get_live_table(hc->md, &srcu_idx); in __hash_remove()
270 dm_put_live_table(hc->md, srcu_idx); in __hash_remove()
275 dm_put(hc->md); in __hash_remove()
285 struct mapped_device *md; in dm_hash_remove_all() local
295 md = hc->md; in dm_hash_remove_all()
296 dm_get(md); in dm_hash_remove_all()
299 dm_lock_for_deletion(md, mark_deferred, only_deferred)) { in dm_hash_remove_all()
300 dm_put(md); in dm_hash_remove_all()
310 dm_sync_table(md); in dm_hash_remove_all()
313 dm_put(md); in dm_hash_remove_all()
315 dm_destroy(md); in dm_hash_remove_all()
317 dm_destroy_immediate(md); in dm_hash_remove_all()
376 struct mapped_device *md; in dm_hash_rename() local
402 dm_put(hc->md); in dm_hash_rename()
427 dm_put(hc->md); in dm_hash_rename()
441 table = dm_get_live_table(hc->md, &srcu_idx); in dm_hash_rename()
444 dm_put_live_table(hc->md, srcu_idx); in dm_hash_rename()
446 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) in dm_hash_rename()
449 md = hc->md; in dm_hash_rename()
453 return md; in dm_hash_rename()
549 disk = dm_disk(hc->md); in list_devices()
556 *event_nr = dm_get_event_nr(hc->md); in list_devices()
683 static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) in dm_get_inactive_table() argument
689 dm_get_live_table(md, srcu_idx); in dm_get_inactive_table()
692 hc = dm_get_mdptr(md); in dm_get_inactive_table()
693 if (!hc || hc->md != md) { in dm_get_inactive_table()
706 static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, in dm_get_live_or_inactive_table() argument
711 dm_get_inactive_table(md, srcu_idx) : dm_get_live_table(md, srcu_idx); in dm_get_live_or_inactive_table()
718 static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) in __dev_status() argument
720 struct gendisk *disk = dm_disk(md); in __dev_status()
727 if (dm_suspended_md(md)) in __dev_status()
730 if (dm_suspended_internally_md(md)) in __dev_status()
733 if (dm_test_deferred_remove_flag(md)) in __dev_status()
743 param->open_count = dm_open_count(md); in __dev_status()
745 param->event_nr = dm_get_event_nr(md); in __dev_status()
748 table = dm_get_live_table(md, &srcu_idx); in __dev_status()
758 dm_put_live_table(md, srcu_idx); in __dev_status()
762 table = dm_get_inactive_table(md, &srcu_idx); in __dev_status()
768 dm_put_live_table(md, srcu_idx); in __dev_status()
775 struct mapped_device *md; in dev_create() local
784 r = dm_create(m, &md); in dev_create()
788 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); in dev_create()
790 dm_put(md); in dev_create()
791 dm_destroy(md); in dev_create()
797 __dev_status(md, param); in dev_create()
799 dm_put(md); in dev_create()
853 struct mapped_device *md = NULL; in find_device() local
858 md = hc->md; in find_device()
861 return md; in find_device()
867 struct mapped_device *md; in dev_remove() local
880 md = hc->md; in dev_remove()
885 r = dm_lock_for_deletion(md, !!(param->flags & DM_DEFERRED_REMOVE), false); in dev_remove()
889 dm_put(md); in dev_remove()
894 dm_put(md); in dev_remove()
902 dm_sync_table(md); in dev_remove()
908 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr)) in dev_remove()
911 dm_put(md); in dev_remove()
912 dm_destroy(md); in dev_remove()
933 struct mapped_device *md; in dev_rename() local
949 md = dm_hash_rename(param, new_data); in dev_rename()
950 if (IS_ERR(md)) in dev_rename()
951 return PTR_ERR(md); in dev_rename()
953 __dev_status(md, param); in dev_rename()
954 dm_put(md); in dev_rename()
962 struct mapped_device *md; in dev_set_geometry() local
968 md = find_device(param); in dev_set_geometry()
969 if (!md) in dev_set_geometry()
997 r = dm_set_geometry(md, &geometry); in dev_set_geometry()
1002 dm_put(md); in dev_set_geometry()
1010 struct mapped_device *md; in do_suspend() local
1012 md = find_device(param); in do_suspend()
1013 if (!md) in do_suspend()
1021 if (!dm_suspended_md(md)) { in do_suspend()
1022 r = dm_suspend(md, suspend_flags); in do_suspend()
1027 __dev_status(md, param); in do_suspend()
1030 dm_put(md); in do_suspend()
1040 struct mapped_device *md; in do_resume() local
1052 md = hc->md; in do_resume()
1067 if (!dm_suspended_md(md)) in do_resume()
1068 dm_suspend(md, suspend_flags); in do_resume()
1070 old_map = dm_swap_table(md, new_map); in do_resume()
1072 dm_sync_table(md); in do_resume()
1074 dm_put(md); in do_resume()
1079 set_disk_ro(dm_disk(md), 0); in do_resume()
1081 set_disk_ro(dm_disk(md), 1); in do_resume()
1084 if (dm_suspended_md(md)) { in do_resume()
1085 r = dm_resume(md); in do_resume()
1086 if (!r && !dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr)) in do_resume()
1098 __dev_status(md, param); in do_resume()
1100 dm_put(md); in do_resume()
1122 struct mapped_device *md; in dev_status() local
1124 md = find_device(param); in dev_status()
1125 if (!md) in dev_status()
1128 __dev_status(md, param); in dev_status()
1129 dm_put(md); in dev_status()
1214 struct mapped_device *md; in dev_wait() local
1218 md = find_device(param); in dev_wait()
1219 if (!md) in dev_wait()
1225 if (dm_wait_event(md, param->event_nr)) { in dev_wait()
1235 __dev_status(md, param); in dev_wait()
1237 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in dev_wait()
1240 dm_put_live_table(md, srcu_idx); in dev_wait()
1243 dm_put(md); in dev_wait()
1335 struct mapped_device *md; in table_load() local
1338 md = find_device(param); in table_load()
1339 if (!md) in table_load()
1342 r = dm_table_create(&t, get_mode(param), param->target_count, md); in table_load()
1346 /* Protect md->type and md->queue against concurrent table loads. */ in table_load()
1347 dm_lock_md_type(md); in table_load()
1352 immutable_target_type = dm_get_immutable_target_type(md); in table_load()
1362 if (dm_get_md_type(md) == DM_TYPE_NONE) { in table_load()
1364 dm_set_md_type(md, dm_table_get_type(t)); in table_load()
1366 /* setup md->queue to reflect md's type (may block) */ in table_load()
1367 r = dm_setup_md_queue(md, t); in table_load()
1372 } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { in table_load()
1374 dm_get_md_type(md), dm_table_get_type(t)); in table_load()
1379 dm_unlock_md_type(md); in table_load()
1383 hc = dm_get_mdptr(md); in table_load()
1384 if (!hc || hc->md != md) { in table_load()
1397 __dev_status(md, param); in table_load()
1400 dm_sync_table(md); in table_load()
1404 dm_put(md); in table_load()
1409 dm_unlock_md_type(md); in table_load()
1413 dm_put(md); in table_load()
1421 struct mapped_device *md; in table_clear() local
1438 md = hc->md; in table_clear()
1442 __dev_status(md, param); in table_clear()
1445 dm_sync_table(md); in table_clear()
1448 dm_put(md); in table_clear()
1495 struct mapped_device *md; in table_deps() local
1499 md = find_device(param); in table_deps()
1500 if (!md) in table_deps()
1503 __dev_status(md, param); in table_deps()
1505 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_deps()
1508 dm_put_live_table(md, srcu_idx); in table_deps()
1510 dm_put(md); in table_deps()
1521 struct mapped_device *md; in table_status() local
1525 md = find_device(param); in table_status()
1526 if (!md) in table_status()
1529 __dev_status(md, param); in table_status()
1531 table = dm_get_live_or_inactive_table(md, param, &srcu_idx); in table_status()
1534 dm_put_live_table(md, srcu_idx); in table_status()
1536 dm_put(md); in table_status()
1547 static int message_for_md(struct mapped_device *md, unsigned argc, char **argv, in message_for_md() argument
1560 return dm_cancel_deferred_remove(md); in message_for_md()
1563 r = dm_stats_message(md, argc, argv, result, maxlen); in message_for_md()
1578 struct mapped_device *md; in target_message() local
1586 md = find_device(param); in target_message()
1587 if (!md) in target_message()
1609 r = message_for_md(md, argc, argv, result, maxlen); in target_message()
1613 table = dm_get_live_table(md, &srcu_idx); in target_message()
1617 if (dm_deleting_md(md)) { in target_message()
1634 dm_put_live_table(md, srcu_idx); in target_message()
1639 __dev_status(md, param); in target_message()
1650 dm_put(md); in target_message()
2023 * @md: Pointer to mapped_device
2027 int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) in dm_copy_name_and_uuid() argument
2032 if (!md) in dm_copy_name_and_uuid()
2036 hc = dm_get_mdptr(md); in dm_copy_name_and_uuid()
2037 if (!hc || hc->md != md) { in dm_copy_name_and_uuid()
2077 struct mapped_device *md; in dm_early_create() local
2091 r = dm_create(m, &md); in dm_early_create()
2096 r = dm_hash_insert(dmi->name, *dmi->uuid ? dmi->uuid : NULL, md); in dm_early_create()
2101 r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md); in dm_early_create()
2122 md->type = dm_table_get_type(t); in dm_early_create()
2123 /* setup md->queue to reflect md's type (may block) */ in dm_early_create()
2124 r = dm_setup_md_queue(md, t); in dm_early_create()
2131 dm_suspend(md, 0); in dm_early_create()
2132 old_map = dm_swap_table(md, t); in dm_early_create()
2137 set_disk_ro(dm_disk(md), !!(dmi->flags & DM_READONLY_FLAG)); in dm_early_create()
2140 r = dm_resume(md); in dm_early_create()
2144 DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name); in dm_early_create()
2145 dm_put(md); in dm_early_create()
2153 dm_put(md); in dm_early_create()
2155 dm_put(md); in dm_early_create()
2156 dm_destroy(md); in dm_early_create()