• Home
  • Raw
  • Download

Lines Matching refs:td

756 	struct dm_thin_device *td, *tmp;  in __write_changed_details()  local
760 list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { in __write_changed_details()
761 if (!td->changed) in __write_changed_details()
764 key = td->id; in __write_changed_details()
766 details.mapped_blocks = cpu_to_le64(td->mapped_blocks); in __write_changed_details()
767 details.transaction_id = cpu_to_le64(td->transaction_id); in __write_changed_details()
768 details.creation_time = cpu_to_le32(td->creation_time); in __write_changed_details()
769 details.snapshotted_time = cpu_to_le32(td->snapshotted_time); in __write_changed_details()
777 if (td->open_count) in __write_changed_details()
778 td->changed = 0; in __write_changed_details()
780 list_del(&td->list); in __write_changed_details()
781 kfree(td); in __write_changed_details()
896 struct dm_thin_device *td, *tmp; in dm_pool_metadata_close() local
899 list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { in dm_pool_metadata_close()
900 if (td->open_count) in dm_pool_metadata_close()
903 list_del(&td->list); in dm_pool_metadata_close()
904 kfree(td); in dm_pool_metadata_close()
936 struct dm_thin_device **td) in __open_device() argument
955 *td = td2; in __open_device()
978 *td = kmalloc(sizeof(**td), GFP_NOIO); in __open_device()
979 if (!*td) in __open_device()
982 (*td)->pmd = pmd; in __open_device()
983 (*td)->id = dev; in __open_device()
984 (*td)->open_count = 1; in __open_device()
985 (*td)->changed = changed; in __open_device()
986 (*td)->aborted_with_changes = false; in __open_device()
987 (*td)->mapped_blocks = le64_to_cpu(details_le.mapped_blocks); in __open_device()
988 (*td)->transaction_id = le64_to_cpu(details_le.transaction_id); in __open_device()
989 (*td)->creation_time = le32_to_cpu(details_le.creation_time); in __open_device()
990 (*td)->snapshotted_time = le32_to_cpu(details_le.snapshotted_time); in __open_device()
992 list_add(&(*td)->list, &pmd->thin_devices); in __open_device()
997 static void __close_device(struct dm_thin_device *td) in __close_device() argument
999 --td->open_count; in __close_device()
1009 struct dm_thin_device *td; in __create_thin() local
1035 r = __open_device(pmd, dev, 1, &td); in __create_thin()
1041 __close_device(td); in __create_thin()
1063 struct dm_thin_device *td; in __set_snapshot_details() local
1065 r = __open_device(pmd, origin, 0, &td); in __set_snapshot_details()
1069 td->changed = 1; in __set_snapshot_details()
1070 td->snapshotted_time = time; in __set_snapshot_details()
1072 snap->mapped_blocks = td->mapped_blocks; in __set_snapshot_details()
1074 __close_device(td); in __set_snapshot_details()
1085 struct dm_thin_device *td; in __create_snap() local
1116 r = __open_device(pmd, dev, 1, &td); in __create_snap()
1120 r = __set_snapshot_details(pmd, td, origin, pmd->time); in __create_snap()
1121 __close_device(td); in __create_snap()
1153 struct dm_thin_device *td; in __delete_device() local
1156 r = __open_device(pmd, dev, 0, &td); in __delete_device()
1160 if (td->open_count > 1) { in __delete_device()
1161 __close_device(td); in __delete_device()
1165 list_del(&td->list); in __delete_device()
1166 kfree(td); in __delete_device()
1391 struct dm_thin_device **td) in dm_pool_open_thin_device() argument
1397 r = __open_device(pmd, dev, 0, td); in dm_pool_open_thin_device()
1403 int dm_pool_close_thin_device(struct dm_thin_device *td) in dm_pool_close_thin_device() argument
1405 down_write(&td->pmd->root_lock); in dm_pool_close_thin_device()
1406 __close_device(td); in dm_pool_close_thin_device()
1407 up_write(&td->pmd->root_lock); in dm_pool_close_thin_device()
1412 dm_thin_id dm_thin_dev_id(struct dm_thin_device *td) in dm_thin_dev_id() argument
1414 return td->id; in dm_thin_dev_id()
1423 static bool __snapshotted_since(struct dm_thin_device *td, uint32_t time) in __snapshotted_since() argument
1425 return td->snapshotted_time > time; in __snapshotted_since()
1428 int dm_thin_find_block(struct dm_thin_device *td, dm_block_t block, in dm_thin_find_block() argument
1433 struct dm_pool_metadata *pmd = td->pmd; in dm_thin_find_block()
1434 dm_block_t keys[2] = { td->id, block }; in dm_thin_find_block()
1458 result->shared = __snapshotted_since(td, exception_time); in dm_thin_find_block()
1466 int dm_thin_find_mapped_range(struct dm_thin_device *td, in dm_thin_find_mapped_range() argument
1482 r = dm_thin_find_block(td, begin, true, &lookup); in dm_thin_find_mapped_range()
1502 r = dm_thin_find_block(td, begin, true, &lookup); in dm_thin_find_mapped_range()
1522 static int __insert(struct dm_thin_device *td, dm_block_t block, in __insert() argument
1527 struct dm_pool_metadata *pmd = td->pmd; in __insert()
1528 dm_block_t keys[2] = { td->id, block }; in __insert()
1538 td->changed = 1; in __insert()
1540 td->mapped_blocks++; in __insert()
1545 int dm_thin_insert_block(struct dm_thin_device *td, dm_block_t block, in dm_thin_insert_block() argument
1550 down_write(&td->pmd->root_lock); in dm_thin_insert_block()
1551 if (!td->pmd->fail_io) in dm_thin_insert_block()
1552 r = __insert(td, block, data_block); in dm_thin_insert_block()
1553 up_write(&td->pmd->root_lock); in dm_thin_insert_block()
1558 static int __remove(struct dm_thin_device *td, dm_block_t block) in __remove() argument
1561 struct dm_pool_metadata *pmd = td->pmd; in __remove()
1562 dm_block_t keys[2] = { td->id, block }; in __remove()
1568 td->mapped_blocks--; in __remove()
1569 td->changed = 1; in __remove()
1574 static int __remove_range(struct dm_thin_device *td, dm_block_t begin, dm_block_t end) in __remove_range() argument
1578 struct dm_pool_metadata *pmd = td->pmd; in __remove_range()
1579 dm_block_t keys[1] = { td->id }; in __remove_range()
1622 td->mapped_blocks -= total_count; in __remove_range()
1623 td->changed = 1; in __remove_range()
1633 int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block) in dm_thin_remove_block() argument
1637 down_write(&td->pmd->root_lock); in dm_thin_remove_block()
1638 if (!td->pmd->fail_io) in dm_thin_remove_block()
1639 r = __remove(td, block); in dm_thin_remove_block()
1640 up_write(&td->pmd->root_lock); in dm_thin_remove_block()
1645 int dm_thin_remove_range(struct dm_thin_device *td, in dm_thin_remove_range() argument
1650 down_write(&td->pmd->root_lock); in dm_thin_remove_range()
1651 if (!td->pmd->fail_io) in dm_thin_remove_range()
1652 r = __remove_range(td, begin, end); in dm_thin_remove_range()
1653 up_write(&td->pmd->root_lock); in dm_thin_remove_range()
1672 bool dm_thin_changed_this_transaction(struct dm_thin_device *td) in dm_thin_changed_this_transaction() argument
1676 down_read(&td->pmd->root_lock); in dm_thin_changed_this_transaction()
1677 r = td->changed; in dm_thin_changed_this_transaction()
1678 up_read(&td->pmd->root_lock); in dm_thin_changed_this_transaction()
1686 struct dm_thin_device *td, *tmp; in dm_pool_changed_this_transaction() local
1689 list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { in dm_pool_changed_this_transaction()
1690 if (td->changed) { in dm_pool_changed_this_transaction()
1691 r = td->changed; in dm_pool_changed_this_transaction()
1700 bool dm_thin_aborted_changes(struct dm_thin_device *td) in dm_thin_aborted_changes() argument
1704 down_read(&td->pmd->root_lock); in dm_thin_aborted_changes()
1705 r = td->aborted_with_changes; in dm_thin_aborted_changes()
1706 up_read(&td->pmd->root_lock); in dm_thin_aborted_changes()
1746 struct dm_thin_device *td; in __set_abort_with_changes_flags() local
1748 list_for_each_entry(td, &pmd->thin_devices, list) in __set_abort_with_changes_flags()
1749 td->aborted_with_changes = td->changed; in __set_abort_with_changes_flags()
1829 int dm_thin_get_mapped_count(struct dm_thin_device *td, dm_block_t *result) in dm_thin_get_mapped_count() argument
1832 struct dm_pool_metadata *pmd = td->pmd; in dm_thin_get_mapped_count()
1836 *result = td->mapped_blocks; in dm_thin_get_mapped_count()
1844 static int __highest_block(struct dm_thin_device *td, dm_block_t *result) in __highest_block() argument
1849 struct dm_pool_metadata *pmd = td->pmd; in __highest_block()
1851 r = dm_btree_lookup(&pmd->tl_info, pmd->root, &td->id, &value_le); in __highest_block()
1860 int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, in dm_thin_get_highest_mapped_block() argument
1864 struct dm_pool_metadata *pmd = td->pmd; in dm_thin_get_highest_mapped_block()
1868 r = __highest_block(td, result); in dm_thin_get_highest_mapped_block()