]> git.karo-electronics.de Git - mv-sheeva.git/commit
Btrfs: fix fiemap
authorJosef Bacik <josef@redhat.com>
Tue, 23 Nov 2010 19:36:57 +0000 (19:36 +0000)
committerChris Mason <chris.mason@oracle.com>
Sat, 27 Nov 2010 18:37:50 +0000 (13:37 -0500)
commit975f84fee2e8a77ee5f41bfe7c5682bf29366b10
treee7e20e775fa4c126273c28d0c7f0ee05b5bb7f5b
parent619c8c763928841b1112e1d417f88bc1d44daecb
Btrfs: fix fiemap

There are two big problems currently with FIEMAP

1) We return extents for holes.  This isn't supposed to happen, we just don't
return extents for holes and then userspace interprets the lack of an extent as
a hole.

2) We sometimes don't set FIEMAP_EXTENT_LAST properly.  This is because we wait
to see a EXTENT_FLAG_VACANCY flag on the em, but this won't happen if say we ask
fiemap to map up to the last extent in a file, and there is nothing but holes up
to the i_size.  To fix this we need to lookup the last extent in this file and
save the logical offset, so if we happen to try and map that extent we can be
sure to set FIEMAP_EXTENT_LAST.

With this patch we now pass xfstest 225, which we never have before.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_io.c