aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-01-07 05:10:12 -0500
committerJosef Bacik <josef@toxicpanda.com>2013-01-14 13:53:22 -0500
commitf9e4fb53938de5db01950c9dfe479703b2f5c964 (patch)
tree95e9e8326d4a39feedc591c8d05de33d5db46d96 /fs/btrfs/inode.c
parent1214b53f90131fee1f950010c43e92455fe598ab (diff)
Btrfs: fix a bug when llseek for delalloc bytes behind prealloc extents
xfstests case 285 complains. It it because btrfs did not try to find unwritten delalloc bytes(only dirty pages, not yet writeback) behind prealloc extents, it ends up finding nothing while we're with SEEK_DATA. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4ddcf79e7894..ac98384b174e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5623,10 +5623,13 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
5623 return em; 5623 return em;
5624 if (em) { 5624 if (em) {
5625 /* 5625 /*
5626 * if our em maps to a hole, there might 5626 * if our em maps to
5627 * actually be delalloc bytes behind it 5627 * - a hole or
5628 * - a pre-alloc extent,
5629 * there might actually be delalloc bytes behind it.
5628 */ 5630 */
5629 if (em->block_start != EXTENT_MAP_HOLE) 5631 if (em->block_start != EXTENT_MAP_HOLE &&
5632 !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
5630 return em; 5633 return em;
5631 else 5634 else
5632 hole_em = em; 5635 hole_em = em;
@@ -5708,6 +5711,8 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
5708 */ 5711 */
5709 em->block_start = hole_em->block_start; 5712 em->block_start = hole_em->block_start;
5710 em->block_len = hole_len; 5713 em->block_len = hole_len;
5714 if (test_bit(EXTENT_FLAG_PREALLOC, &hole_em->flags))
5715 set_bit(EXTENT_FLAG_PREALLOC, &em->flags);
5711 } else { 5716 } else {
5712 em->start = range_start; 5717 em->start = range_start;
5713 em->len = found; 5718 em->len = found;