Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-05-04 Thread Paolo Bonzini
Il 24/04/2012 08:29, Ronnie Sahlberg ha scritto:
 +itask-bs-total_sectors= rc16-returned_lba *
 +   rc16-block_length / BDRV_SECTOR_SIZE ;

Ronnie, does this need to be (rc16-returned_lba + 1) * ...?

READ CAPACITY returns the highest valid LBA, not the size.

Please send a patch to fix this up if that's the case.

Paolo



Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-05-04 Thread ronnie sahlberg
On Fri, May 4, 2012 at 6:06 PM, Paolo Bonzini pbonz...@redhat.com wrote:
 Il 24/04/2012 08:29, Ronnie Sahlberg ha scritto:
 +    itask-bs-total_sectors    = rc16-returned_lba *
 +                               rc16-block_length / BDRV_SECTOR_SIZE ;

 Ronnie, does this need to be (rc16-returned_lba + 1) * ...?

 READ CAPACITY returns the highest valid LBA, not the size.

 Please send a patch to fix this up if that's the case.


Absolutely. A patch is on its way.
This is probably the third time I have made the same mistake of
RC10/16 returns the lba of last block, not the number of blocks.
I think READCAPACITY is just not compatible with my brain here.


regards
ronnie sahlberg



Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-04-24 Thread Paolo Bonzini
Il 24/04/2012 08:29, Ronnie Sahlberg ha scritto:
 Update the configure test for libiscsi support to detect version 1.3 or later.
 Version 1.3 of libiscsi provides both READCAPACITY16 as well as UNMAP 
 commands.
 
 Update the iscsi block layer to use READCAPACITY16 to detect the size of the 
 LUN instead of READCAPACITY10. This allows support for LUNs larger than 2TB.
 
 Update to implement bdrv_aio_discard() using the UNMAP command.
 This allows us to use thin-provisioned LUNs from TGTD and other iSCSI targets 
 that support thin-provisioning.

Looks good.  Kevin, do you want me to take libiscsi patches via the SCSI
tree?

As an aside, I am not really sure of the utility of adding these utility
functions directly in libiscsi, rather than making it a pure transport
library.  block/iscsi.c is going to grow as you add more functionality
(e.g. WRITE SAME commands), and libiscsi will have to be updated each
time in lockstep.

I can see the value of basic read/write/flush and readcap10/16, but with
unmap it's starting to be a bit more specific.  Are there other clients
of libiscsi that use these functions?  Should they be placed into
block/iscsi.c or a new block/iscsi-cdb.c instead?

Paolo



Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-04-24 Thread ronnie sahlberg
On Tue, Apr 24, 2012 at 4:46 PM, Paolo Bonzini pbonz...@redhat.com wrote:
 Il 24/04/2012 08:29, Ronnie Sahlberg ha scritto:
 Update the configure test for libiscsi support to detect version 1.3 or 
 later.
 Version 1.3 of libiscsi provides both READCAPACITY16 as well as UNMAP 
 commands.

 Update the iscsi block layer to use READCAPACITY16 to detect the size of the 
 LUN instead of READCAPACITY10. This allows support for LUNs larger than 2TB.

 Update to implement bdrv_aio_discard() using the UNMAP command.
 This allows us to use thin-provisioned LUNs from TGTD and other iSCSI 
 targets that support thin-provisioning.

 Looks good.  Kevin, do you want me to take libiscsi patches via the SCSI
 tree?

 As an aside, I am not really sure of the utility of adding these utility
 functions directly in libiscsi, rather than making it a pure transport
 library.  block/iscsi.c is going to grow as you add more functionality
 (e.g. WRITE SAME commands), and libiscsi will have to be updated each
 time in lockstep.

 I can see the value of basic read/write/flush and readcap10/16, but with
 unmap it's starting to be a bit more specific.  Are there other clients
 of libiscsi that use these functions?  Should they be placed into
 block/iscsi.c or a new block/iscsi-cdb.c instead?

I see your point.
I like to add scsi commands as I use them to libiscsi, since then I
dont have to
re-write the marshalling/unmarshalling code everytime in my small test
and utility programs.
For example when i want to write some one-off small tools to test something.


But, yes. There is no real need to use them directly from qemu.


So ignore this patch for now. I will redo UNMAP in the patch to
instead use the generic scsi function inside libiscsi.

That will serve the purpose to verify that the public API in libiscsi
is sufficient for accessing the generic transport and
secondly that will show a useful example on how to send CDB+data to
and to receive data back from the generic function.

This generic API would be what a future virt-scsi-libiscsi
integration would use anyway.



regards
ronnie sahlberg



Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-04-24 Thread Kevin Wolf
Am 24.04.2012 08:46, schrieb Paolo Bonzini:
 Il 24/04/2012 08:29, Ronnie Sahlberg ha scritto:
 Update the configure test for libiscsi support to detect version 1.3 or 
 later.
 Version 1.3 of libiscsi provides both READCAPACITY16 as well as UNMAP 
 commands.

 Update the iscsi block layer to use READCAPACITY16 to detect the size of the 
 LUN instead of READCAPACITY10. This allows support for LUNs larger than 2TB.

 Update to implement bdrv_aio_discard() using the UNMAP command.
 This allows us to use thin-provisioned LUNs from TGTD and other iSCSI 
 targets that support thin-provisioning.
 
 Looks good.  Kevin, do you want me to take libiscsi patches via the SCSI
 tree?

Sure, if you like, go ahead. Feel free to update MAINTAINERS as well.

 As an aside, I am not really sure of the utility of adding these utility
 functions directly in libiscsi, rather than making it a pure transport
 library.  block/iscsi.c is going to grow as you add more functionality
 (e.g. WRITE SAME commands), and libiscsi will have to be updated each
 time in lockstep.
 
 I can see the value of basic read/write/flush and readcap10/16, but with
 unmap it's starting to be a bit more specific.  Are there other clients
 of libiscsi that use these functions?  Should they be placed into
 block/iscsi.c or a new block/iscsi-cdb.c instead?

I think I agree. For the more obscure commands, the qemu driver should
probably build the CDB on its own and use a generic function.

Kevin



Re: [Qemu-devel] [PATCH] ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

2012-04-24 Thread Paolo Bonzini
Il 24/04/2012 10:02, ronnie sahlberg ha scritto:
 So ignore this patch for now. I will redo UNMAP in the patch to
 instead use the generic scsi function inside libiscsi.
 
 That will serve the purpose to verify that the public API in libiscsi
 is sufficient for accessing the generic transport and
 secondly that will show a useful example on how to send CDB+data to
 and to receive data back from the generic function.
 
 This generic API would be what a future virt-scsi-libiscsi
 integration would use anyway.

I will be on holiday from tomorrow to May 1, and I won't be able to send
a pull request today.  As I want to minimize the time I spend looking at
qemu-devel, :) I'll take this patch as is, since the new libiscsi
version is needed anyway for READ CAPACITY (16).

You could write a follow-up patch to teach iscsi.c about WRITE SAME(10)
and WRITE SAME(16) with the unmap bit set, and use generic CDB+data
functions for those.

Paolo