Re: [Qemu-devel] ]PATCH 0/7] add TRIM/UNMAP support, v3

2010-12-16 Thread Kevin Wolf
Am 10.12.2010 16:00, schrieb Christoph Hellwig:
 This patchset adds support for the ATA TRIM and SCSI WRITE SAME with
 unmap commands, which allow reclaiming free space from a backing image.
 
 The user facing implementation is pretty complete, but not really
 efficient because the underlying bdrv_discard implementation doesn't
 use the aio implementation yet.  The reason for that is that the SCSI
 layer doesn't really allow any asynchronous commands except for
 READ/WRITE by design, and implementing the ATA TRIM command with it's
 multiple ranges is rather painful, and combined with the SCSI limitation
 I didn't bother yet.  The only backend support so far is the XFS hole
 punching ioctl, but others can be added easily when they become
 available.  A virtio implementation for a discard command would also
 be pretty easy, but until we actually support a better backend then
 a plain sparse file it's not worth using for production enviroments
 anyway, but more for playing with the thin provisioning infrastructure,
 or observing guest behaviour when TRIM / unmap is supported.
 
 If the support is enabled and the backend doesn't support hole punching
 the TRIM / WRITE SAME commands become no-ops so that migration from
 hosts supporting or not supporting it works.
 
 Version 3:
   - refactor IDE dma support code
   - proper brace obsfucation
   - fix compile without xfs headers
   - use bool instead of int for a one-byte flag
 
 Version 2:
   - replace tabs with spaces
   - return -ENOMEDIUM from bdrv_discard if there's no driver
 assigned
   - actually list the TP EVPD page as supported when querying
 for supported EVPD pages

The SCSI changes seem to apply, but the rest conflicts with recent
changes, most notably AHCI. Can you rebase on top of the block branch?

I also found some minor things in the SCSI code, so I'll take the chance
to comment on them.

Kevin



Re: [Qemu-devel] ]PATCH 0/7] add TRIM/UNMAP support, v3

2010-12-16 Thread Christoph Hellwig
On Thu, Dec 16, 2010 at 04:43:20PM +0100, Kevin Wolf wrote:
 The SCSI changes seem to apply, but the rest conflicts with recent
 changes, most notably AHCI. Can you rebase on top of the block branch?

I've tried to, but with the maze of pointer indirections I'm totally
lost for now.  I'll have to drop the IDE side for now until that area
gets less messy or I get a lot more time.




Re: [Qemu-devel] ]PATCH 0/7] add TRIM/UNMAP support, v3

2010-12-13 Thread Christoph Hellwig
On Sun, Dec 12, 2010 at 03:28:14PM +, Stefan Hajnoczi wrote:
 Do you have qemu-io support for discard?

Now that you wrote it we have the support :)

 Any hints on testing this?  A recent guest kernel and ext -o discard
 might exercise the code but I haven't tried yet.

Anything that submits a discard in the guest is fine.  The simples thing
to test are the various mkfs tools, as they do a whole device discard.
Also -o discard for various Linux filesystem works, Mark Lord's wiper.sh
script, or any Windows 7 installation.




Re: [Qemu-devel] ]PATCH 0/7] add TRIM/UNMAP support, v3

2010-12-12 Thread Stefan Hajnoczi
Do you have qemu-io support for discard?

Any hints on testing this?  A recent guest kernel and ext -o discard
might exercise the code but I haven't tried yet.

Stefan



[Qemu-devel] ]PATCH 0/7] add TRIM/UNMAP support, v3

2010-12-10 Thread Christoph Hellwig
This patchset adds support for the ATA TRIM and SCSI WRITE SAME with
unmap commands, which allow reclaiming free space from a backing image.

The user facing implementation is pretty complete, but not really
efficient because the underlying bdrv_discard implementation doesn't
use the aio implementation yet.  The reason for that is that the SCSI
layer doesn't really allow any asynchronous commands except for
READ/WRITE by design, and implementing the ATA TRIM command with it's
multiple ranges is rather painful, and combined with the SCSI limitation
I didn't bother yet.  The only backend support so far is the XFS hole
punching ioctl, but others can be added easily when they become
available.  A virtio implementation for a discard command would also
be pretty easy, but until we actually support a better backend then
a plain sparse file it's not worth using for production enviroments
anyway, but more for playing with the thin provisioning infrastructure,
or observing guest behaviour when TRIM / unmap is supported.

If the support is enabled and the backend doesn't support hole punching
the TRIM / WRITE SAME commands become no-ops so that migration from
hosts supporting or not supporting it works.

Version 3:
- refactor IDE dma support code
- proper brace obsfucation
- fix compile without xfs headers
- use bool instead of int for a one-byte flag

Version 2:
- replace tabs with spaces
- return -ENOMEDIUM from bdrv_discard if there's no driver
  assigned
- actually list the TP EVPD page as supported when querying
  for supported EVPD pages