fs: btrfs: support sparse extents
PATCH v2 1/1 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 <[email protected]>
--- fs/btrfs/extent-io.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/extent-io.c +6 -0
@@ -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 ;
Signature · 1 line
2.24.1
PATCH v2 1/1 fs: btrfs: support sparse extents
Quoted 7 lines · Marek Beh?n
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 physicalSigned-off-by Marek Beh?n <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200421/7eb4d34d/attachment.sig>