From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLE2j-0003w7-Np for qemu-devel@nongnu.org; Wed, 05 Mar 2014 10:47:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLE2e-00017y-MS for qemu-devel@nongnu.org; Wed, 05 Mar 2014 10:47:37 -0500 Received: from lnantes-156-75-100-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:55721 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLE2e-00017b-Ft for qemu-devel@nongnu.org; Wed, 05 Mar 2014 10:47:32 -0500 Date: Wed, 5 Mar 2014 16:47:30 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140305154730.GA1868@irqsave.net> References: <1394031649-31915-1-git-send-email-kwolf@redhat.com> <1394031649-31915-2-git-send-email-kwolf@redhat.com> <20140305153323.GA1709@irqsave.net> <20140305154120.GC4483@dhcp-200-207.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20140305154120.GC4483@dhcp-200-207.str.redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] iscsi: Use bs->sg for everything else than disks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , pbonzini@redhat.com, pl@kamp.de, qemu-devel@nongnu.org The Wednesday 05 Mar 2014 =E0 16:41:20 (+0100), Kevin Wolf wrote : > Am 05.03.2014 um 16:33 hat Beno=EEt Canet geschrieben: > > The Wednesday 05 Mar 2014 =E0 16:00:48 (+0100), Kevin Wolf wrote : > > > The current iscsi block driver code makes the rather arbitrary deci= sion > > > that TYPE_MEDIUM_CHANGER and TYPE_TAPE devices have bs->sg =3D 1 an= d all > > > other device types are disks. > > >=20 > > > Instead of this, check for TYPE_DISK to expose the disk interface a= nd > > > make everything else bs->sg =3D 1. In particular, this includes dev= ices > > > with TYPE_STORAGE_ARRAY, which is what LUN 0 of an iscsi target is. > > > (See https://bugzilla.redhat.com/show_bug.cgi?id=3D1067784 for the = exact > > > scenario.) > > >=20 > > > Signed-off-by: Kevin Wolf > > > --- > > > block/iscsi.c | 9 ++++----- > > > 1 file changed, 4 insertions(+), 5 deletions(-) > > >=20 > > > diff --git a/block/iscsi.c b/block/iscsi.c > > > index 0a15f53..b490e98 100644 > > > --- a/block/iscsi.c > > > +++ b/block/iscsi.c > > > @@ -1231,12 +1231,11 @@ static int iscsi_open(BlockDriverState *bs,= QDict *options, int flags, > > > bs->total_sectors =3D sector_lun2qemu(iscsilun->num_blocks, is= csilun); > > > bs->request_alignment =3D iscsilun->block_size; > > > =20 > > > - /* Medium changer or tape. We dont have any emulation for this= so this must > > > - * be sg ioctl compatible. We force it to be sg, otherwise qem= u will try > > > - * to read from the device to guess the image format. > > > + /* We don't have any emulation for devices other than disks an= d CD-ROMs, so > > > + * this must be sg ioctl compatible. We force it to be sg, oth= erwise qemu > > > + * will try to read from the device to guess the image format. > > > */ > > > - if (iscsilun->type =3D=3D TYPE_MEDIUM_CHANGER || > > > - iscsilun->type =3D=3D TYPE_TAPE) { > > > + if (iscsilun->type !=3D TYPE_DISK && iscsilun->type !=3D TYPE_= ROM) { > > I don't understand you are talking about type TYPE_STORAGE_ARRAY in t= he commit > > message but testing against TYPE_ROM and they are not the same. > > Maybe a comment explaining the role of TYPE_ROM would give a clue to = non scsi > > savy persons like me. >=20 > TYPE_STORAGE_ARRAY is what exposed the bug (see the Bugzilla reference)= . > It was previously bs->sg =3D 0, but becomes now bs->sg =3D 1. The reaso= n for > this is that the usual block layer operations only work on disks (i.e. > hard disks =3D TYPE_DISK and CD-ROM drives =3D TYPE_ROM), so for all th= e > rest we can only expose a generic SCSI device, but no real block device= . Ok I didn't knew that TYPE_ROM =3D=3D type of CDROM. It's simpler now. Reviewed-by: Benoit Canet >=20 > Kevin >=20