qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Trying to get fstrim / discard=unmap to work
Date: Mon, 10 Mar 2014 17:57:01 +0100	[thread overview]
Message-ID: <531DEEDD.20007@redhat.com> (raw)
In-Reply-To: <20140310161421.GB6744@redhat.com>

Il 10/03/2014 17:14, Richard W.M. Jones ha scritto:
> On Mon, Mar 10, 2014 at 04:11:20PM +0000, Richard W.M. Jones wrote:
>> Guest:
>>  - guest kernel: 3.13.4-200.fc20.x86_64
>>  - ext4 guest filesystem
>>  - fstrim from util-linux 2.24.1
>>  - cat /sys/block/sda/device/scsi_disk/*/provisioning_mode
>>    unmap
>
> I noticed that I wasn't mounting the guest filesystem with '-o discard'.
> However it still doesn't work even after adding this option.

Works here:

$ qemu-system-x86_64 -drive 
discard=unmap,file=$HOME/jeos-19-64.qcow2,id=ff,if=none -device 
virtio-scsi-pci -device scsi-disk,drive=ff -vnc :0 --enable-kvm

Before test:
$ du -h jeos-19-64.qcow2
1,6G	jeos-19-64.qcow2

After "dd if=/dev/zero of=foo bs=1M count=300":
$ du -h jeos-19-64.qcow2
1,8G	jeos-19-64.qcow2

After "rm foo; fstrim -v /":
$ du -h jeos-19-64.qcow2
1,4G	jeos-19-64.qcow2

I also set a breakpoint on fallocate64, and it was called.

Paolo

  reply	other threads:[~2014-03-10 16:57 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 [this message]
2014-03-10 17:15     ` Richard W.M. Jones
2014-03-11 20:00     ` Richard W.M. Jones
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=531DEEDD.20007@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@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 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).