--On 16 September 2011 11:26:53 +0200 Wouter Verhelst <[email protected]> wrote:

>> I think you can use debugfs's dump_extents command (from memory).
>
> Yes, but that requires an unmounted filesystem. If I want to add this to
> the test suite, that's not going to work.

Format a file as an ext4 file system. Loopback mount it. Put your test
disk in there as a file. Do your stuff. Unmount it. Check it.

The loopback mount requires root privileges, but the alternative is
to use the syscall (can't remember). I think that needs root privs
anyway, and won't work if someone is running on a different file
system (who knows is tmpfs supports PUNCH_HOLE).

A heuristic way would be:
* create the file non-sparse with dd from /dev/zero
* run tests
* run du, and check it is significantly smaller (du reports actual
  file space taken, in contrast to stat()).

That's only going to work on file systems that support files.

-- 
Alex Bligh

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to