All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: Making discard/fstrim reliable
Date: Wed, 26 Mar 2014 20:47:08 +0000	[thread overview]
Message-ID: <20140326204708.GA29191@redhat.com> (raw)


virt-sparsify is a tool for trimming free space in virtual disk
images.  The new implementation uses vfs/kernel/qemu discard support.
Essentially it does:

  for each filesystem:
    mount -o discard $fs /mnt
    sync
    fstrim /mnt
    umount /mnt
  sync
  # qemu is killed after sync returns

Although typing these commands by hand works fine, when you run them
from a program the fstrim doesn't happen all the way down the stack
reliably.  Mostly it works, but sometimes it only trims some space
from the host file.

It appears that when the host is slow / under load, the problem
happens more frequently.  Also it may happen more frequently on i686
than on x86-64 (possibly also due to speed of host).

The question is: What can I do to make sure the trim happens reliably,
all the way down the stack, before qemu is killed?

I am testing this using the latest upstream kernel & qemu.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

             reply	other threads:[~2014-03-26 20:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 20:47 Richard W.M. Jones [this message]
2014-04-02 18:18 ` Making discard/fstrim reliable Jeff Moyer
2014-04-02 18:59   ` Richard W.M. Jones
2014-04-02 20:02     ` Jeff Moyer
2014-04-02 20:26       ` Richard W.M. Jones
2014-04-10 15:05       ` Richard W.M. Jones
2014-04-03 17:08 ` Lukáš Czerner
2014-04-03 17:23   ` Richard W.M. Jones
2014-04-03 17:57   ` Paolo Bonzini
2014-04-03 18:08     ` Richard W.M. Jones

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=20140326204708.GA29191@redhat.com \
    --to=rjones@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.