From: Josef Bacik <jbacik@fb.com>
Date: Tue, 19 May 2015 14:44:04 +0000 (-0400)
Subject: Btrfs: set UNWRITTEN for prealloc'ed extents in fiemap
X-Git-Tag: firefly_0821_release~176^2~1298^2~66
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d2b2372e097cd3b4150d3ec91e79ac3c5cc750e;p=firefly-linux-kernel-4.4.55.git

Btrfs: set UNWRITTEN for prealloc'ed extents in fiemap

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>
---

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 856c2e8ea6ac..a3ec2c8610cc 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -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;