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.
I see, thanks a lot for suggestion.
Just to make it clear, this is more like working around file-system
bugs, which, as I guess, were present in early days of FIEMAP.
I'll look into adding FIEMAP_FLAG_SYNC to Fiemap.py in bmap-tools,
thanks!
--
Best Regards,
Artem Bityutskiy