From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLprn-0005Ig-8x for qemu-devel@nongnu.org; Wed, 10 Oct 2012 02:34:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLprm-0008Iz-2G for qemu-devel@nongnu.org; Wed, 10 Oct 2012 02:34:03 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:51762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLprl-0008It-S7 for qemu-devel@nongnu.org; Wed, 10 Oct 2012 02:34:01 -0400 Received: by mail-wg0-f53.google.com with SMTP id dr1so118451wgb.10 for ; Tue, 09 Oct 2012 23:34:01 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <507516D5.8040609@redhat.com> Date: Wed, 10 Oct 2012 08:33:57 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <00c501cda602$583de850$08b9b8f0$@cn.fujitsu.com> <20121009172100.GA23380@lst.de> <014001cda68c$94a58480$bdf08d80$@cn.fujitsu.com> In-Reply-To: <014001cda68c$94a58480$bdf08d80$@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Use SCSI command to get size of SG device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen HanXiao Cc: 'Christoph Hellwig' , qemu-devel@nongnu.org Il 10/10/2012 04:11, Chen HanXiao ha scritto: >> > >> > On Tue, Oct 09, 2012 at 05:42:01PM +0800, Chen HanXiao wrote: >>> > > When we use SCSI generic device as disk image, function lseek could >>> > > not get the size of this kind of device. >>> > > So try to use SCSI command Read Capacity(10) when lseek failed to get >>> > > the size of SCSI generic device. >> > >> > Eww, this is ugly as hell. Why would you even need the size for a raw >> > passthrough device? > > If we want to enable snapshot for SCSI generic device as disk image, the size > of SCSI generic device is needed. Function lseek could not get this, SCSI > command can finish the job. > Only when lseek failed would Read Capacity command be sent. You need to use scsi-block instead of scsi-generic. However, I don't see how this can work. After the snapshot, the image will be qcow2, not raw, and thus it will not support bdrv_aio_ioctl. Hence any SCSI command (for scsi-generic) or any non-data SCSI command (for scsi-block) will fail. Can you give an example of what exactly you are trying to do? Paolo