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