History

Btrfs: do not offset physical if we're compressed

xfstest btrfs/276 was freaking out on slower boxes partly because fiemap was offsetting the physical based on the extent offset. This is perfectly fine with uncompressed extents, however the extent offset is into the uncompressed area, not the compressed. So we can return a physical value that isn't at all within the area we have allocated on disk. Fix this by returning the start of the extent if it is compressed no matter what the offset. Thanks,

Josef Bacik committed 13 years ago

Commit b76bb701 parent b5b9b5b1 file · +6 −3Browse files

Unified · Split

fs/btrfs/extent_io.c+6−3
@@ -4048,7 +4048,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 4047 unmodified lines
40484048 }
40494049
40504050 while (!end) {
4051− u64 offset_in_extent;
4051+ u64 offset_in_extent = 0;
40524052
40534053 /* break if the extent we found is outside the range */
40544054 if (em->start >= max || extent_map_end(em) < off)
@@ -4064,9 +4064,12 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 9 unmodified lines
40644064
40654065 /*
40664066 * record the offset from the start of the extent
4067− * for adjusting the disk offset below
4067+ * for adjusting the disk offset below. Only do this if the
4068+ * extent isn't compressed since our in ram offset may be past
4069+ * what we have actually allocated on disk.
40684070 */
4069− offset_in_extent = em_start - em->start;
4071+ if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
4072+ offset_in_extent = em_start - em->start;
40704073 em_end = extent_map_end(em);
40714074 em_len = em_end - em_start;
40724075 emflags = em->flags;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t