From: Paolo Bonzini <pbonzini@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Teng-Feng Yang <shinrairis@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] TRIM/DISCARD/UNMAP support on qemu-nbd
Date: Wed, 08 Jan 2014 23:11:35 +0100 [thread overview]
Message-ID: <52CDCD17.8070508@redhat.com> (raw)
In-Reply-To: <20140107212210.GB4802@redhat.com>
Il 07/01/2014 22:22, Richard W.M. Jones ha scritto:
> On Tue, Jan 07, 2014 at 09:48:17PM +0100, Paolo Bonzini wrote:
>> Il 07/01/2014 21:27, Richard W.M. Jones ha scritto:
>>> Not much more what I said in the original email (especially see the
>>> attached script which you can download from the bottom of this page:
>>> https://lists.gnu.org/archive/html/qemu-devel/2014-01/msg00084.html )
>>>
>>> Basically it tries to dd /dev/zero into the virtio-scsi device exposed
>>> by qemu, then calls sg_unmap (there are two devices, it only unmaps
>>> the first so we can hopefully see the difference), but it doesn't seem
>>> to have any effect on the underlying file. The underlying file is a
>>> regular raw-format file on ext4.
>>>
>>> I called sg_readcap/sg_vpd and we seem to have all the right
>>> capability bits exposed.
>>>
>>> This script won't work with regular libguestfs. I compiled a special
>>> appliance that had the sg tools included.
>>
>> Try again with the pull request of
>> http://permalink.gmane.org/gmane.comp.emulators.qemu/248421
>
> No difference from before, as far as I can see.
>
> Here is the output of sparsetest.sh:
Is guestfish using "discard=on"? Here is my test:
$ qemu-img create test.img 32M
Formatting 'test.img', fmt=raw size=33554432
$ qemu-img map --output=json test.img
[{ "start": 0, "length": 33554432, "depth": 0, "zero": true, "data":
false, "offset": 0}]
$ qemu-system-x86_64 ~/rhel6.img \
-drive if=none,cache=none,discard=on,file=test.img,id=test \
-device virtio-scsi-pci -device scsi-disk,drive=test \
--enable-kvm -m 512
========
In guest
========
# sg_readcap /dev/sdb
Device size: 33554432 bytes, 32.0 MiB, 0.03 GB
# cat /sys/block/sdb/device/scsi_disk/*/provisioning_mode
unmap
# yes | mkfs.ext4 /dev/sdb
# mount /dev/sdb test
# dd if=/dev/zero of=test/test bs=1M
$ du -sh test.img
32M test.img
========
In guest
========
# rm xfs/test
(sync here if it does not work)
# fstrim -v xfs/
xfs/: 27891712 bytes were trimmed
$ du -sh test.img
5.2M test.img
next prev parent reply other threads:[~2014-01-08 22:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-30 11:58 [Qemu-devel] TRIM/DISCARD/UNMAP support on qemu-nbd Teng-Feng Yang
2014-01-02 16:15 ` Richard W.M. Jones
2014-01-07 14:48 ` Paolo Bonzini
2014-01-07 20:27 ` Richard W.M. Jones
2014-01-07 20:48 ` Paolo Bonzini
2014-01-07 21:22 ` Richard W.M. Jones
2014-01-08 22:11 ` Paolo Bonzini [this message]
2014-01-08 22:24 ` Richard W.M. Jones
2014-01-08 22:45 ` Paolo Bonzini
2014-01-08 22:53 ` Richard W.M. Jones
2014-01-09 7:02 ` Paolo Bonzini
2014-01-07 21:27 ` Richard W.M. Jones
2014-01-06 2:45 ` Stefan Hajnoczi
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=52CDCD17.8070508@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=shinrairis@gmail.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).