Btrfs: set UNWRITTEN for prealloc'ed extents in fiemap
authorJosef Bacik <jbacik@fb.com>
Tue, 19 May 2015 14:44:04 +0000 (10:44 -0400)
committerChris Mason <clm@fb.com>
Wed, 3 Jun 2015 11:03:03 +0000 (04:03 -0700)
We should be doing this, it's weird we hadn't been doing this.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent_io.c

index 856c2e8ea6acd8b03f0eae1de196fc120529b5e9..a3ec2c8610cc374313d7248b3b04fe884a90c938 100644 (file)
@@ -4497,6 +4497,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                }
                if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
                        flags |= FIEMAP_EXTENT_ENCODED;
+               if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
+                       flags |= FIEMAP_EXTENT_UNWRITTEN;
 
                free_extent_map(em);
                em = NULL;