From: Yevgeny Popovych Date: Tue, 5 Jun 2018 10:11:01 +0000 (+0300) Subject: fs: btrfs: Fix not all CHUNK_ITEMs being read from CHUNK_TREE X-Git-Tag: v2018.07-rc2~62 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f559180176a8650a78edb5be73935f51cd6a0064;p=oweals%2Fu-boot.git 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 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 Cc: Marek Behun Cc: Sergey Struzh Reviewed-by: Marek Behun --- diff --git a/fs/btrfs/chunk-map.c b/fs/btrfs/chunk-map.c index b3b5ef7652..beb6a4bb92 100644 --- a/fs/btrfs/chunk-map.c +++ b/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);