Skip to content

Commit

Permalink
fs: btrfs: Fix not all CHUNK_ITEMs being read from CHUNK_TREE
Browse files Browse the repository at this point in the history
This causes errors when translating logical addresses to physical:
  btrfs_map_logical_to_physical: Cannot map logical address <addr> to physical
  btrfs_file_read: Error reading extent

The behavior of btrfs_map_logical_to_physical() is to stop traversing
CHUNK_TREE when it encounters first non-CHUNK_ITEM, which makes
only some portion of CHUNK_ITEMs being read.
Change it to skip over non-chunk items.

Signed-off-by: Yevgeny Popovych <[email protected]>
Cc: Marek Behun <[email protected]>
Cc: Sergey Struzh <[email protected]>
Reviewed-by: Marek Behun <[email protected]>
  • Loading branch information
Jmennius authored and trini committed Jun 13, 2018
1 parent 5b3da7f commit f559180
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/chunk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int btrfs_read_chunk_tree(void)
do {
found_key = btrfs_path_leaf_key(&path);
if (btrfs_comp_keys_type(&key, found_key))
break;
continue;

chunk = btrfs_path_item_ptr(&path, struct btrfs_chunk);
btrfs_chunk_to_cpu(chunk);
Expand Down

0 comments on commit f559180

Please sign in to comment.