summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-io.c')
-rw-r--r--fs/btrfs/extent-io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent-io.c b/fs/btrfs/extent-io.c
index 66d0e1c7d6..2e4599cf64 100644
--- a/fs/btrfs/extent-io.c
+++ b/fs/btrfs/extent-io.c
@@ -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;