Lines Matching refs:r
371 int r; in __superblock_all_zeroes() local
380 r = dm_bm_read_lock(bm, THIN_SUPERBLOCK_LOCATION, NULL, &b); in __superblock_all_zeroes()
381 if (r) in __superblock_all_zeroes()
382 return r; in __superblock_all_zeroes()
436 int r; in __write_initial_superblock() local
445 r = dm_sm_root_size(pmd->metadata_sm, &metadata_len); in __write_initial_superblock()
446 if (r < 0) in __write_initial_superblock()
447 return r; in __write_initial_superblock()
449 r = dm_sm_root_size(pmd->data_sm, &data_len); in __write_initial_superblock()
450 if (r < 0) in __write_initial_superblock()
451 return r; in __write_initial_superblock()
453 r = dm_sm_commit(pmd->data_sm); in __write_initial_superblock()
454 if (r < 0) in __write_initial_superblock()
455 return r; in __write_initial_superblock()
457 r = dm_tm_pre_commit(pmd->tm); in __write_initial_superblock()
458 if (r < 0) in __write_initial_superblock()
459 return r; in __write_initial_superblock()
461 r = superblock_lock_zero(pmd, &sblock); in __write_initial_superblock()
462 if (r) in __write_initial_superblock()
463 return r; in __write_initial_superblock()
474 r = dm_sm_copy_root(pmd->metadata_sm, &disk_super->metadata_space_map_root, in __write_initial_superblock()
476 if (r < 0) in __write_initial_superblock()
479 r = dm_sm_copy_root(pmd->data_sm, &disk_super->data_space_map_root, in __write_initial_superblock()
481 if (r < 0) in __write_initial_superblock()
494 return r; in __write_initial_superblock()
499 int r; in __format_metadata() local
501 r = dm_tm_create_with_sm(pmd->bm, THIN_SUPERBLOCK_LOCATION, in __format_metadata()
503 if (r < 0) { in __format_metadata()
505 return r; in __format_metadata()
511 r = PTR_ERR(pmd->data_sm); in __format_metadata()
518 r = -ENOMEM; in __format_metadata()
524 r = dm_btree_empty(&pmd->info, &pmd->root); in __format_metadata()
525 if (r < 0) in __format_metadata()
528 r = dm_btree_empty(&pmd->details_info, &pmd->details_root); in __format_metadata()
529 if (r < 0) { in __format_metadata()
534 r = __write_initial_superblock(pmd); in __format_metadata()
535 if (r) in __format_metadata()
548 return r; in __format_metadata()
581 int r; in __open_metadata() local
585 r = dm_bm_read_lock(pmd->bm, THIN_SUPERBLOCK_LOCATION, in __open_metadata()
587 if (r < 0) { in __open_metadata()
589 return r; in __open_metadata()
594 r = __check_incompat_features(disk_super, pmd); in __open_metadata()
595 if (r < 0) in __open_metadata()
598 r = dm_tm_open_with_sm(pmd->bm, THIN_SUPERBLOCK_LOCATION, in __open_metadata()
602 if (r < 0) { in __open_metadata()
611 r = PTR_ERR(pmd->data_sm); in __open_metadata()
618 r = -ENOMEM; in __open_metadata()
633 return r; in __open_metadata()
638 int r, unformatted; in __open_or_format_metadata() local
640 r = __superblock_all_zeroes(pmd->bm, &unformatted); in __open_or_format_metadata()
641 if (r) in __open_or_format_metadata()
642 return r; in __open_or_format_metadata()
652 int r; in __create_persistent_data_objects() local
662 r = __open_or_format_metadata(pmd, format_device); in __create_persistent_data_objects()
663 if (r) in __create_persistent_data_objects()
666 return r; in __create_persistent_data_objects()
680 int r; in __begin_transaction() local
688 r = dm_bm_read_lock(pmd->bm, THIN_SUPERBLOCK_LOCATION, in __begin_transaction()
690 if (r) in __begin_transaction()
691 return r; in __begin_transaction()
707 int r; in __write_changed_details() local
724 r = dm_btree_insert(&pmd->details_info, pmd->details_root, in __write_changed_details()
726 if (r) in __write_changed_details()
727 return r; in __write_changed_details()
742 int r; in __commit_transaction() local
752 r = __write_changed_details(pmd); in __commit_transaction()
753 if (r < 0) in __commit_transaction()
754 return r; in __commit_transaction()
756 r = dm_sm_commit(pmd->data_sm); in __commit_transaction()
757 if (r < 0) in __commit_transaction()
758 return r; in __commit_transaction()
760 r = dm_tm_pre_commit(pmd->tm); in __commit_transaction()
761 if (r < 0) in __commit_transaction()
762 return r; in __commit_transaction()
764 r = dm_sm_root_size(pmd->metadata_sm, &metadata_len); in __commit_transaction()
765 if (r < 0) in __commit_transaction()
766 return r; in __commit_transaction()
768 r = dm_sm_root_size(pmd->data_sm, &data_len); in __commit_transaction()
769 if (r < 0) in __commit_transaction()
770 return r; in __commit_transaction()
772 r = superblock_lock(pmd, &sblock); in __commit_transaction()
773 if (r) in __commit_transaction()
774 return r; in __commit_transaction()
783 r = dm_sm_copy_root(pmd->metadata_sm, &disk_super->metadata_space_map_root, in __commit_transaction()
785 if (r < 0) in __commit_transaction()
788 r = dm_sm_copy_root(pmd->data_sm, &disk_super->data_space_map_root, in __commit_transaction()
790 if (r < 0) in __commit_transaction()
797 return r; in __commit_transaction()
804 int r; in dm_pool_metadata_open() local
821 r = __create_persistent_data_objects(pmd, format_device); in dm_pool_metadata_open()
822 if (r) { in dm_pool_metadata_open()
824 return ERR_PTR(r); in dm_pool_metadata_open()
827 r = __begin_transaction(pmd); in dm_pool_metadata_open()
828 if (r < 0) { in dm_pool_metadata_open()
831 return ERR_PTR(r); in dm_pool_metadata_open()
839 int r; in dm_pool_metadata_close() local
861 r = __commit_transaction(pmd); in dm_pool_metadata_close()
862 if (r < 0) in dm_pool_metadata_close()
864 __func__, r); in dm_pool_metadata_close()
883 int r, changed = 0; in __open_device() local
907 r = dm_btree_lookup(&pmd->details_info, pmd->details_root, in __open_device()
909 if (r) { in __open_device()
910 if (r != -ENODATA || !create) in __open_device()
911 return r; in __open_device()
950 int r; in __create_thin() local
957 r = dm_btree_lookup(&pmd->details_info, pmd->details_root, in __create_thin()
959 if (!r) in __create_thin()
965 r = dm_btree_empty(&pmd->bl_info, &dev_root); in __create_thin()
966 if (r) in __create_thin()
967 return r; in __create_thin()
974 r = dm_btree_insert(&pmd->tl_info, pmd->root, &key, &value, &pmd->root); in __create_thin()
975 if (r) { in __create_thin()
977 return r; in __create_thin()
980 r = __open_device(pmd, dev, 1, &td); in __create_thin()
981 if (r) { in __create_thin()
984 return r; in __create_thin()
988 return r; in __create_thin()
993 int r = -EINVAL; in dm_pool_create_thin() local
997 r = __create_thin(pmd, dev); in dm_pool_create_thin()
1000 return r; in dm_pool_create_thin()
1007 int r; in __set_snapshot_details() local
1010 r = __open_device(pmd, origin, 0, &td); in __set_snapshot_details()
1011 if (r) in __set_snapshot_details()
1012 return r; in __set_snapshot_details()
1027 int r; in __create_snap() local
1035 r = dm_btree_lookup(&pmd->details_info, pmd->details_root, in __create_snap()
1037 if (!r) in __create_snap()
1041 r = dm_btree_lookup(&pmd->tl_info, pmd->root, &key, &value); in __create_snap()
1042 if (r) in __create_snap()
1043 return r; in __create_snap()
1053 r = dm_btree_insert(&pmd->tl_info, pmd->root, &key, &value, &pmd->root); in __create_snap()
1054 if (r) { in __create_snap()
1056 return r; in __create_snap()
1061 r = __open_device(pmd, dev, 1, &td); in __create_snap()
1062 if (r) in __create_snap()
1065 r = __set_snapshot_details(pmd, td, origin, pmd->time); in __create_snap()
1068 if (r) in __create_snap()
1077 return r; in __create_snap()
1084 int r = -EINVAL; in dm_pool_create_snap() local
1088 r = __create_snap(pmd, dev, origin); in dm_pool_create_snap()
1091 return r; in dm_pool_create_snap()
1096 int r; in __delete_device() local
1101 r = __open_device(pmd, dev, 0, &td); in __delete_device()
1102 if (r) in __delete_device()
1103 return r; in __delete_device()
1112 r = dm_btree_remove(&pmd->details_info, pmd->details_root, in __delete_device()
1114 if (r) in __delete_device()
1115 return r; in __delete_device()
1117 r = dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root); in __delete_device()
1118 if (r) in __delete_device()
1119 return r; in __delete_device()
1127 int r = -EINVAL; in dm_pool_delete_thin_device() local
1131 r = __delete_device(pmd, dev); in dm_pool_delete_thin_device()
1134 return r; in dm_pool_delete_thin_device()
1141 int r = -EINVAL; in dm_pool_set_metadata_transaction_id() local
1154 r = 0; in dm_pool_set_metadata_transaction_id()
1159 return r; in dm_pool_set_metadata_transaction_id()
1165 int r = -EINVAL; in dm_pool_get_metadata_transaction_id() local
1170 r = 0; in dm_pool_get_metadata_transaction_id()
1174 return r; in dm_pool_get_metadata_transaction_id()
1179 int r, inc; in __reserve_metadata_snap() local
1188 r = dm_tm_shadow_block(pmd->tm, THIN_SUPERBLOCK_LOCATION, in __reserve_metadata_snap()
1190 if (r) in __reserve_metadata_snap()
1191 return r; in __reserve_metadata_snap()
1224 r = superblock_lock(pmd, &sblock); in __reserve_metadata_snap()
1225 if (r) { in __reserve_metadata_snap()
1227 return r; in __reserve_metadata_snap()
1238 int r = -EINVAL; in dm_pool_reserve_metadata_snap() local
1242 r = __reserve_metadata_snap(pmd); in dm_pool_reserve_metadata_snap()
1245 return r; in dm_pool_reserve_metadata_snap()
1250 int r; in __release_metadata_snap() local
1255 r = superblock_lock(pmd, &sblock); in __release_metadata_snap()
1256 if (r) in __release_metadata_snap()
1257 return r; in __release_metadata_snap()
1270 r = dm_tm_read_lock(pmd->tm, held_root, &sb_validator, ©); in __release_metadata_snap()
1271 if (r) in __release_metadata_snap()
1272 return r; in __release_metadata_snap()
1284 int r = -EINVAL; in dm_pool_release_metadata_snap() local
1288 r = __release_metadata_snap(pmd); in dm_pool_release_metadata_snap()
1291 return r; in dm_pool_release_metadata_snap()
1297 int r; in __get_metadata_snap() local
1301 r = dm_bm_read_lock(pmd->bm, THIN_SUPERBLOCK_LOCATION, in __get_metadata_snap()
1303 if (r) in __get_metadata_snap()
1304 return r; in __get_metadata_snap()
1315 int r = -EINVAL; in dm_pool_get_metadata_snap() local
1319 r = __get_metadata_snap(pmd, result); in dm_pool_get_metadata_snap()
1322 return r; in dm_pool_get_metadata_snap()
1328 int r = -EINVAL; in dm_pool_open_thin_device() local
1332 r = __open_device(pmd, dev, 0, td); in dm_pool_open_thin_device()
1335 return r; in dm_pool_open_thin_device()
1360 int r = -EINVAL; in dm_thin_find_block() local
1378 r = dm_btree_lookup(info, pmd->root, keys, &value); in dm_thin_find_block()
1379 if (!r) in dm_thin_find_block()
1385 if (!r) { in dm_thin_find_block()
1394 return r; in dm_thin_find_block()
1400 int r, inserted; in __insert() local
1408 r = dm_btree_insert_notify(&pmd->info, pmd->root, keys, &value, in __insert()
1410 if (r) in __insert()
1411 return r; in __insert()
1423 int r = -EINVAL; in dm_thin_insert_block() local
1427 r = __insert(td, block, data_block); in dm_thin_insert_block()
1430 return r; in dm_thin_insert_block()
1435 int r; in __remove() local
1439 r = dm_btree_remove(&pmd->info, pmd->root, keys, &pmd->root); in __remove()
1440 if (r) in __remove()
1441 return r; in __remove()
1451 int r = -EINVAL; in dm_thin_remove_block() local
1455 r = __remove(td, block); in dm_thin_remove_block()
1458 return r; in dm_thin_remove_block()
1463 int r; in dm_thin_changed_this_transaction() local
1466 r = td->changed; in dm_thin_changed_this_transaction()
1469 return r; in dm_thin_changed_this_transaction()
1474 bool r; in dm_thin_aborted_changes() local
1477 r = td->aborted_with_changes; in dm_thin_aborted_changes()
1480 return r; in dm_thin_aborted_changes()
1485 int r = -EINVAL; in dm_pool_alloc_data_block() local
1489 r = dm_sm_new_block(pmd->data_sm, result); in dm_pool_alloc_data_block()
1492 return r; in dm_pool_alloc_data_block()
1497 int r = -EINVAL; in dm_pool_commit_metadata() local
1503 r = __commit_transaction(pmd); in dm_pool_commit_metadata()
1504 if (r <= 0) in dm_pool_commit_metadata()
1510 r = __begin_transaction(pmd); in dm_pool_commit_metadata()
1513 return r; in dm_pool_commit_metadata()
1526 int r = -EINVAL; in dm_pool_abort_metadata() local
1534 r = __create_persistent_data_objects(pmd, false); in dm_pool_abort_metadata()
1535 if (r) in dm_pool_abort_metadata()
1541 return r; in dm_pool_abort_metadata()
1546 int r = -EINVAL; in dm_pool_get_free_block_count() local
1550 r = dm_sm_get_nr_free(pmd->data_sm, result); in dm_pool_get_free_block_count()
1553 return r; in dm_pool_get_free_block_count()
1559 int r = -EINVAL; in dm_pool_get_free_metadata_block_count() local
1563 r = dm_sm_get_nr_free(pmd->metadata_sm, result); in dm_pool_get_free_metadata_block_count()
1566 return r; in dm_pool_get_free_metadata_block_count()
1572 int r = -EINVAL; in dm_pool_get_metadata_dev_size() local
1576 r = dm_sm_get_nr_blocks(pmd->metadata_sm, result); in dm_pool_get_metadata_dev_size()
1579 return r; in dm_pool_get_metadata_dev_size()
1593 int r = -EINVAL; in dm_pool_get_data_dev_size() local
1597 r = dm_sm_get_nr_blocks(pmd->data_sm, result); in dm_pool_get_data_dev_size()
1600 return r; in dm_pool_get_data_dev_size()
1605 int r = -EINVAL; in dm_thin_get_mapped_count() local
1611 r = 0; in dm_thin_get_mapped_count()
1615 return r; in dm_thin_get_mapped_count()
1620 int r; in __highest_block() local
1625 r = dm_btree_lookup(&pmd->tl_info, pmd->root, &td->id, &value_le); in __highest_block()
1626 if (r) in __highest_block()
1627 return r; in __highest_block()
1637 int r = -EINVAL; in dm_thin_get_highest_mapped_block() local
1642 r = __highest_block(td, result); in dm_thin_get_highest_mapped_block()
1645 return r; in dm_thin_get_highest_mapped_block()
1650 int r; in __resize_space_map() local
1653 r = dm_sm_get_nr_blocks(sm, &old_count); in __resize_space_map()
1654 if (r) in __resize_space_map()
1655 return r; in __resize_space_map()
1670 int r = -EINVAL; in dm_pool_resize_data_dev() local
1674 r = __resize_space_map(pmd->data_sm, new_count); in dm_pool_resize_data_dev()
1677 return r; in dm_pool_resize_data_dev()
1682 int r = -EINVAL; in dm_pool_resize_metadata_dev() local
1686 r = __resize_space_map(pmd->metadata_sm, new_count); in dm_pool_resize_metadata_dev()
1689 return r; in dm_pool_resize_metadata_dev()
1705 int r; in dm_pool_register_metadata_threshold() local
1708 r = dm_sm_register_threshold_callback(pmd->metadata_sm, threshold, fn, context); in dm_pool_register_metadata_threshold()
1711 return r; in dm_pool_register_metadata_threshold()