[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] fstrim & upstream kernel not working
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] fstrim & upstream kernel not working |
Date: |
Fri, 14 Mar 2014 13:24:33 +0000 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Fri, Mar 14, 2014 at 01:47:59PM +0100, Paolo Bonzini wrote:
> Il 14/03/2014 13:42, Richard W.M. Jones ha scritto:
> >I worked around this in any case by rearranging the test [2]:
> >
> >Doing:
> >
> > rm /a_big_file
> > fstrim /
> > sync
> > umount /
> > [shut down qemu]
> >
> >would only trim 64 KB on the host.
> >
> >Doing:
> >
> > rm /a_big_file
> > umount / # added
> > mount -o nodiscard /dev/sda / # added
> > fstrim /
> > sync
> > umount /
> > [shut down qemu]
> >
> >would trim the expected amount (around 10 MB).
> >
> >I've no idea why this is (looks like an ext4/kernel bug to me), but in
> >any case the tests now use the second method[2].
>
> Could be a race condition (something going on in the background
> between rm and fstrim).
Not much happens in the libguestfs appliance. There are usually only
two processes (udev + guestfsd).
> Try syncing before fstrim, not after. In
> fact the sync before umount should not be necessary.
Yes, that works with both upstream kernel+qemu and with F21 kernel+qemu.
https://github.com/libguestfs/libguestfs/commit/d46ceea6014006ab19b6f795e2e28a7360d90b2c
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org