On Sun, 2013-08-18 at 16:43 +0100, Pádraig Brady wrote:
You definitely need the fsync before doing the fiemap.
We saw this on certain file systems including ext4 when adding
fiemap support (efficient reading of holes) to cp.
This is a bug in the fiemap interface IMHO in that it returns
fairly useless data unless FIEMAP_FLAG_SYNC is specified.
For a general utility like cp, we couldn't sync each file before copying
(even only large files), so we restrict fiemap usage to files that
have a different disk usage than apparent size and so probably contain holes.
FYI, I've just made sure I use the FIEMAP_FLAG_SYNC is used in the
project.
--
Best Regards,
Artem Bityutskiy