qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Trying to get fstrim / discard=unmap to work
Date: Tue, 11 Mar 2014 20:00:50 +0000	[thread overview]
Message-ID: <20140311200050.GU1346@redhat.com> (raw)
In-Reply-To: <531DEEDD.20007@redhat.com>

Finally I tracked down the reason why my early test failed, but then
it just started working "by magic".

The reason is this:

If you:

- create an ext4 filesystem
 - mount it WITHOUT -o discard
 - create and remove some big files
 - unmount
 - mount -o discard
 - fstrim

then the fstrim has no effect.

If you:

 - create an ext4 filesystem
 - mount it WITH -o discard
 - create and remove some big files
 - unmount
 - mount -o discard
 - fstrim

then the fstrim works.  (Actually it's not necessary, because the
previous 'rm' already recovered the space.)

I have no idea why this is yet (still investigating).  However the
fstrim is suspiciously fast, so there's no way it can be scanning the
whole disk for deleted files.  I don't think fstrim does what it says
in the man page.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

  parent reply	other threads:[~2014-03-11 20:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 16:11 [Qemu-devel] Trying to get fstrim / discard=unmap to work Richard W.M. Jones
2014-03-10 16:14 ` Richard W.M. Jones
2014-03-10 16:57   ` Paolo Bonzini
2014-03-10 17:15     ` Richard W.M. Jones
2014-03-11 20:00     ` Richard W.M. Jones [this message]
2014-03-12 17:55       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140311200050.GU1346@redhat.com \
    --to=rjones@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).