[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] TRIM stuff





--On 16 September 2011 11:26:53 +0200 Wouter Verhelst <w@...112...> 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



Reply to: