On Wed, Apr 02, 2014 at 04:02:57PM -0400, Jeff Moyer wrote: > "Richard W.M. Jones" <rjones@xxxxxxxxxx> writes: > > Yes and no. We examine the partitions, logical volumes and so on in > > order to get a list of mountable filesystems, and then the list is > > iterated over in this loop. The precise code for finding the > > filesystems is here: > > > > https://github.com/libguestfs/libguestfs/blob/master/src/listfs.c#L45 > > > > ^ That code is running on the host side. It issues various calls to > > the appliance side which are executed by code in multiple files here: > > > > https://github.com/libguestfs/libguestfs/tree/master/daemon > > Sorry, that's a lot to take in. Can you distill this down to exactly > the parts involved in the problem you're seeing? Pretend I don't know > anything about libguestfs (I don't). Libguestfs runs up a small appliance, running the daemon above. The library side sends the daemon commands which the daemon runs. The commands that are run map nearly 1-1 to the libguestfs API. The test program is this: # Add the disk to qemu. $g->add_drive ($disk, format => $format, readonly => 0, discard => "enable"); # Run qemu. $g->launch (); # Run mkfs -t ext4 /dev/sda in the appliance. $g->mkfs ("ext4", "/dev/sda"); # Run mount -o nodiscard /dev/sda / # [This is different from my earlier description, but it is done # deliberately so rm doesn't trim the space, because the test is # trying to test fstrim, not rm. Discard of rm is tested in another test.] $g->mount_options ("nodiscard", "/dev/sda", "/"); # Create a 10000000 byte file /data containing '!' characters. $g->fill (33, 10000000, "/data"); # Sync the (guest) disk. $g->sync (); # The host file is examined here. my $full_size = (stat ($disk))[12]; # Remove the large data file. Because of -o nodiscard this won't trim. $g->rm ("/data"); # Run fstrim in the appliance. $g->fstrim ("/"); # This issues a sync for the guest disk, and kills qemu. $g->shutdown (); # The host file is examined again. my $trimmed_size = (stat ($disk))[12]; if ($full_size - $trimmed_size < 1000) { # then print an error and die } > I suggest you create a golden image that you copy for each test that > already has the data committed to it. The test would then just issue > the rm and discard. Sure I'll try this. Will take a little time to implement it and run the tests in various environments. > It's only 64MB in size, right? That could certainly affect things! So I'm guessing this is too small? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html