* [PATCH] fs: btrfs: support sparse extents
@ 2020-03-30 16:41 Marek Behún
2020-03-30 17:06 ` Marek Behun
0 siblings, 1 reply; 2+ messages in thread
From: Marek Behún @ 2020-03-30 16:41 UTC (permalink / raw)
To: u-boot
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>
---
fs/btrfs/extent-io.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/btrfs/extent-io.c b/fs/btrfs/extent-io.c
index 66d0e1c7d6..53899bf79a 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, dlen);
+ return dlen;
+ }
+
physical = btrfs_map_logical_to_physical(extent->disk_bytenr);
if (physical == -1ULL)
return -1ULL;
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] fs: btrfs: support sparse extents
2020-03-30 16:41 [PATCH] fs: btrfs: support sparse extents Marek Behún
@ 2020-03-30 17:06 ` Marek Behun
0 siblings, 0 replies; 2+ messages in thread
From: Marek Behun @ 2020-03-30 17:06 UTC (permalink / raw)
To: u-boot
Sorry, dont apply this. I've sent v2.
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-30 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-30 16:41 [PATCH] fs: btrfs: support sparse extents Marek Behún
2020-03-30 17:06 ` Marek Behun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox