qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] TRIM/DISCARD/UNMAP support on qemu-nbd


From: Richard W.M. Jones
Subject: Re: [Qemu-devel] TRIM/DISCARD/UNMAP support on qemu-nbd
Date: Tue, 7 Jan 2014 20:27:08 +0000
User-agent: Mutt/1.5.20 (2009-12-10)

On Tue, Jan 07, 2014 at 03:48:54PM +0100, Paolo Bonzini wrote:
> Il 02/01/2014 17:15, Richard W.M. Jones ha scritto:
> > 
> > My (possibly weak) understanding of the upstream qemu code is that
> > unmap/discard/trim is not supported in qcow2.  It is only supported in
> > raw files when using a POSIX-like host OS which has either of:
> > 
> >  - block devices supporting BLKDISCARDZEROES
> >  - files on XFS
> >  - files on other filesystems that support FALLOC_FL_PUNCH_HOLE (eg ext4)
> 
> It doesn't have to support BLKDISCARDZEROES, only BLKDISCARD.  I test it
> with scsi_debug using both lbprz=0 and lbprz=1 (which becomes
> BLKDISCARDZEROES unset and set respectively).
> 
> Otherwise this is correct.
> 
> > Having said that, I did some tests using libguestfs and I could not
> > show that unmap was working, either using raw or qcow2 (both on ext4),
> > with virtio-scsi, and recent kernel & qemu.  I did not see any errors,
> > but also I don't see what I'm doing wrong.
> 
> Can you share more?

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.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]