Public Member Functions | |
| BtrfsRecoveryImpl (DiskReader &reader) | |
| bool | recover (uint64_t volume_offset, const std::string &output_dir, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs, std::string &error) |
Private Member Functions | |
| void | parse_system_chunk_array (const unsigned char *data, uint32_t size) |
| const ChunkMapEntry * | find_chunk_entry (uint64_t logical) const |
| bool | validate_raid6_candidate (const std::vector< std::vector< unsigned char > > &bufs, const std::vector< bool > &ok, const std::vector< size_t > &data_cols, const std::map< size_t, size_t > &data_index, size_t p_col, size_t q_col, const unsigned char *candidate, size_t candidate_col, size_t chunk) |
| bool | reconstruct_raid56_read (const ChunkMapEntry &entry, uint64_t logical, unsigned char *out, size_t chunk) |
| void | sort_chunk_map () |
| bool | logical_to_physical (uint64_t logical, std::vector< uint64_t > &physical_candidates, uint64_t &available) const |
| bool | read_logical (uint64_t logical, void *buffer, size_t len) |
| bool | read_tree_block (uint64_t logical_bytenr, std::vector< unsigned char > &block) |
| bool | load_chunk_tree (std::vector< std::string > &logs) |
| bool | load_root_tree (std::vector< std::string > &logs, std::string &error) |
| template<typename LeafFn> | |
| void | walk_tree (uint64_t logical_bytenr, LeafFn &&leaf_fn) |
| template<typename LeafFn> | |
| void | walk_tree_internal (uint64_t logical_bytenr, LeafFn &leaf_fn) |
| bool | collect_fs_root (uint64_t root_id, const RootEntry &root, FsRootState &state, std::vector< std::string > &logs) |
| fs::path | inode_relative_path (uint64_t inode, const FsRootState &state) const |
| bool | read_logical_bytes (uint64_t logical, uint64_t length, std::vector< unsigned char > &out) |
| bool | render_extent (const FileExtentInfo &extent, std::vector< unsigned char > &out, bool &compressed_ok, bool &compressed_skipped) |
| size_t | export_fs_root (uint64_t root_id, const RootEntry &root, const FsRootState &state, std::vector< RecoveredFileRecord > &recovered, size_t &compressed_exported, size_t &compressed_skipped, std::vector< std::string > &logs) |
Private Attributes | |
| DiskReader & | reader_ |
| uint64_t | volume_offset_ {0} |
| uint64_t | root_tree_bytenr_ {0} |
| uint64_t | chunk_root_bytenr_ {0} |
| uint64_t | root_dir_objectid_ {256} |
| uint32_t | nodesize_ {0} |
| uint64_t | super_generation_ {0} |
| std::array< unsigned char, 16 > | fsid_ {} |
| fs::path | out_root_ |
| std::vector< ChunkMapEntry > | chunk_map_ |
| std::map< uint64_t, RootEntry > | roots_ |
| std::set< uint64_t > | visited_tree_blocks_ |
Definition at line 348 of file btrfs_recovery.cpp.
|
inlineexplicit |
|
inlineprivate |
Definition at line 895 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_DIR_INDEX_KEY, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_DIR_ITEM_KEY, anonymous_namespace{btrfs_recovery.cpp}::RootEntry::bytenr, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::key, anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::type, and walk_tree().
Referenced by recover().
|
inlineprivate |
Definition at line 1012 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::FsRootState::extents, inode_relative_path(), anonymous_namespace{btrfs_recovery.cpp}::FsRootState::inodes, anonymous_namespace{btrfs_recovery.cpp}::RootEntry::name, out_root_, render_extent(), anonymous_namespace{btrfs_recovery.cpp}::sanitize(), and trs().
Referenced by recover().
|
inlineprivate |
Definition at line 478 of file btrfs_recovery.cpp.
References chunk_map_.
Referenced by read_logical(), and read_tree_block().
|
inlineprivate |
Definition at line 943 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::FsRootState::parent_edge, and root_dir_objectid_.
Referenced by export_fs_root().
|
inlineprivate |
Definition at line 802 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_CHUNK_ITEM_KEY, chunk_map_, chunk_root_bytenr_, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_offset, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_size, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::key, anonymous_namespace{btrfs_recovery.cpp}::le16(), anonymous_namespace{btrfs_recovery.cpp}::le64(), anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::offset, sort_chunk_map(), trs(), anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::type, and walk_tree().
Referenced by recover().
|
inlineprivate |
Definition at line 826 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_ROOT_BACKREF_KEY, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_ROOT_ITEM_KEY, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_ROOT_REF_KEY, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_offset, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_size, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::key, anonymous_namespace{btrfs_recovery.cpp}::le16(), anonymous_namespace{btrfs_recovery.cpp}::le64(), anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::objectid, anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::offset, root_dir_objectid_, root_tree_bytenr_, roots_, anonymous_namespace{btrfs_recovery.cpp}::sanitize(), trs(), anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::type, and walk_tree().
Referenced by recover().
|
inlineprivate |
Definition at line 663 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_DUP, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID0, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID1, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID10, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID5, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID6, chunk_map_, and volume_offset_.
Referenced by read_logical().
|
inlineprivate |
Definition at line 454 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_CHUNK_ITEM_KEY, chunk_map_, anonymous_namespace{btrfs_recovery.cpp}::le16(), anonymous_namespace{btrfs_recovery.cpp}::le64(), anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::offset, anonymous_namespace{btrfs_recovery.cpp}::parse_key(), sort_chunk_map(), and anonymous_namespace{btrfs_recovery.cpp}::BtrfsKey::type.
Referenced by recover().
|
inlineprivate |
Definition at line 758 of file btrfs_recovery.cpp.
References find_chunk_entry(), logical_to_physical(), DiskReader::read_at(), reader_, and reconstruct_raid56_read().
Referenced by read_logical_bytes(), and read_tree_block().
|
inlineprivate |
Definition at line 960 of file btrfs_recovery.cpp.
References read_logical().
Referenced by render_extent().
|
inlineprivate |
Definition at line 785 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID5, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID6, find_chunk_entry(), fsid_, nodesize_, read_logical(), reconstruct_raid56_read(), super_generation_, anonymous_namespace{btrfs_recovery.cpp}::ChunkMapEntry::type, and anonymous_namespace{btrfs_recovery.cpp}::validate_tree_block_header().
Referenced by walk_tree_internal().
|
inlineprivate |
Definition at line 518 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID5, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_BLOCK_GROUP_RAID6, anonymous_namespace{btrfs_recovery.cpp}::gf_inv_byte(), anonymous_namespace{btrfs_recovery.cpp}::gf_mul_byte(), anonymous_namespace{btrfs_recovery.cpp}::gf_pow2(), anonymous_namespace{btrfs_recovery.cpp}::ChunkMapEntry::logical, DiskReader::read_at(), reader_, anonymous_namespace{btrfs_recovery.cpp}::ChunkMapEntry::stripe_length, anonymous_namespace{btrfs_recovery.cpp}::ChunkMapEntry::stripes, anonymous_namespace{btrfs_recovery.cpp}::ChunkMapEntry::type, validate_raid6_candidate(), and volume_offset_.
Referenced by read_logical(), and read_tree_block().
|
inline |
Definition at line 352 of file btrfs_recovery.cpp.
References chunk_map_, chunk_root_bytenr_, collect_fs_root(), export_fs_root(), fsid_, anonymous_namespace{btrfs_recovery.cpp}::le32(), anonymous_namespace{btrfs_recovery.cpp}::le64(), load_chunk_tree(), load_root_tree(), nodesize_, out_root_, parse_system_chunk_array(), DiskReader::read_at(), reader_, root_dir_objectid_, root_tree_bytenr_, roots_, super_generation_, anonymous_namespace{btrfs_recovery.cpp}::to_hex(), trs(), and volume_offset_.
Referenced by BtrfsRecovery::recover().
|
inlineprivate |
Definition at line 965 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BTRFS_FILE_EXTENT_INLINE, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_FILE_EXTENT_PREALLOC, anonymous_namespace{btrfs_recovery.cpp}::BTRFS_FILE_EXTENT_REG, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::compression, anonymous_namespace{btrfs_recovery.cpp}::decompress_payload(), anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::disk_bytenr, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::disk_num_bytes, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::extent_offset, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::inline_data, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::num_bytes, anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::ram_bytes, read_logical_bytes(), and anonymous_namespace{btrfs_recovery.cpp}::FileExtentInfo::type.
Referenced by export_fs_root().
|
inlineprivate |
Definition at line 657 of file btrfs_recovery.cpp.
References chunk_map_.
Referenced by load_chunk_tree(), and parse_system_chunk_array().
|
inlineprivate |
Definition at line 485 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::gf_mul_byte(), and anonymous_namespace{btrfs_recovery.cpp}::gf_pow2().
Referenced by reconstruct_raid56_read().
|
inlineprivate |
Definition at line 855 of file btrfs_recovery.cpp.
References visited_tree_blocks_, and walk_tree_internal().
Referenced by collect_fs_root(), load_chunk_tree(), and load_root_tree().
|
inlineprivate |
Definition at line 861 of file btrfs_recovery.cpp.
References anonymous_namespace{btrfs_recovery.cpp}::BtrfsKeyPtr::blockptr, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_offset, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::data_size, anonymous_namespace{btrfs_recovery.cpp}::BtrfsKeyPtr::generation, anonymous_namespace{btrfs_recovery.cpp}::BtrfsItem::key, anonymous_namespace{btrfs_recovery.cpp}::BtrfsKeyPtr::key, anonymous_namespace{btrfs_recovery.cpp}::le32(), anonymous_namespace{btrfs_recovery.cpp}::le64(), anonymous_namespace{btrfs_recovery.cpp}::parse_key(), read_tree_block(), visited_tree_blocks_, and walk_tree_internal().
Referenced by walk_tree(), and walk_tree_internal().
|
private |
Definition at line 450 of file btrfs_recovery.cpp.
Referenced by find_chunk_entry(), load_chunk_tree(), logical_to_physical(), parse_system_chunk_array(), recover(), and sort_chunk_map().
|
private |
Definition at line 444 of file btrfs_recovery.cpp.
Referenced by load_chunk_tree(), and recover().
|
private |
Definition at line 448 of file btrfs_recovery.cpp.
Referenced by read_tree_block(), and recover().
|
private |
Definition at line 446 of file btrfs_recovery.cpp.
Referenced by read_tree_block(), and recover().
|
private |
Definition at line 449 of file btrfs_recovery.cpp.
Referenced by export_fs_root(), and recover().
|
private |
Definition at line 441 of file btrfs_recovery.cpp.
Referenced by BtrfsRecoveryImpl(), read_logical(), reconstruct_raid56_read(), and recover().
|
private |
Definition at line 445 of file btrfs_recovery.cpp.
Referenced by inode_relative_path(), load_root_tree(), and recover().
|
private |
Definition at line 443 of file btrfs_recovery.cpp.
Referenced by load_root_tree(), and recover().
|
private |
Definition at line 451 of file btrfs_recovery.cpp.
Referenced by load_root_tree(), and recover().
|
private |
Definition at line 447 of file btrfs_recovery.cpp.
Referenced by read_tree_block(), and recover().
|
private |
Definition at line 452 of file btrfs_recovery.cpp.
Referenced by walk_tree(), and walk_tree_internal().
|
private |
Definition at line 442 of file btrfs_recovery.cpp.
Referenced by logical_to_physical(), reconstruct_raid56_read(), and recover().