fs: btrfs: Fix not all CHUNK_ITEMs being read from CHUNK_TREE

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 <yevgenyp@pointgrab.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Sergey Struzh <sergeys@pointgrab.com>
Reviewed-by: Marek Behun <marek.behun@nic.cz>
lime2-spi
Yevgeny Popovych 6 years ago committed by Tom Rini
parent 5b3da7fa12
commit f559180176
  1. 2
      fs/btrfs/chunk-map.c

@ -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);

Loading…
Cancel
Save