mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
fs: btrfs: support sparse extents
When logical address of a regular extent is 0, the extent is sparse and consists of all zeros. Without this when sparse extents are used in a file reading fails with Cannot map logical address 0 to physical Signed-off-by: Marek Behún <marek.behun@nic.cz>
This commit is contained in:
parent
f4a1426fd6
commit
48180e15d3
1 changed files with 6 additions and 0 deletions
|
@ -78,6 +78,12 @@ u64 btrfs_read_extent_reg(struct btrfs_path *path,
|
|||
if (size > dlen - offset)
|
||||
size = dlen - offset;
|
||||
|
||||
/* sparse extent */
|
||||
if (extent->disk_bytenr == 0) {
|
||||
memset(out, 0, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
physical = btrfs_map_logical_to_physical(extent->disk_bytenr);
|
||||
if (physical == -1ULL)
|
||||
return -1ULL;
|
||||
|
|
Loading…
Reference in a new issue