Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234091
b: refs/heads/master
c: ea8efc7
h: refs/heads/master
i:
  234089: 6d6663b
  234087: b28f6fc
v: v3
  • Loading branch information
Chris Mason committed Mar 8, 2011
1 parent 0df76f5 commit 48753c4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31339acd07b4ba687906702085127895a56eb920
refs/heads/master: ea8efc74bd0402b4d5f663d007b4e25fa29ea778
33 changes: 27 additions & 6 deletions trunk/fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3046,17 +3046,38 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
}

while (!end) {
off = extent_map_end(em);
if (off >= max)
end = 1;
u64 offset_in_extent;

/* break if the extent we found is outside the range */
if (em->start >= max || extent_map_end(em) < off)
break;

/*
* get_extent may return an extent that starts before our
* requested range. We have to make sure the ranges
* we return to fiemap always move forward and don't
* overlap, so adjust the offsets here
*/
em_start = max(em->start, off);

em_start = em->start;
em_len = em->len;
/*
* record the offset from the start of the extent
* for adjusting the disk offset below
*/
offset_in_extent = em_start - em->start;
em_end = extent_map_end(em);
em_len = em_end - em_start;
emflags = em->flags;
disko = 0;
flags = 0;

/*
* bump off for our next call to get_extent
*/
off = extent_map_end(em);
if (off >= max)
end = 1;

if (em->block_start == EXTENT_MAP_LAST_BYTE) {
end = 1;
flags |= FIEMAP_EXTENT_LAST;
Expand All @@ -3067,7 +3088,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
flags |= (FIEMAP_EXTENT_DELALLOC |
FIEMAP_EXTENT_UNKNOWN);
} else {
disko = em->block_start;
disko = em->block_start + offset_in_extent;
}
if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
flags |= FIEMAP_EXTENT_ENCODED;
Expand Down

0 comments on commit 48753c4

Please sign in to comment.