From mboxrd@z Thu Jan 1 00:00:00 1970 From: john cooper Subject: Re: [PATCH 2/2] Add serial number support for virtio_blk, V4 Date: Wed, 03 Jun 2009 11:08:37 -0400 Message-ID: <4A2691F5.6080500@redhat.com> References: <4A1F615F.1090701@redhat.com> <200906011640.02632.rusty@rustcorp.com.au> <20090603101758.GK11363@kernel.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Rusty Russell , KVM list , qemu-devel@nongnu.org, Christoph Hellwig , john.cooper@redhat.com To: Jens Axboe Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45092 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754035AbZFCPMr (ORCPT ); Wed, 3 Jun 2009 11:12:47 -0400 In-Reply-To: <20090603101758.GK11363@kernel.dk> Sender: kvm-owner@vger.kernel.org List-ID: Jens Axboe wrote: > On Mon, Jun 01 2009, Rusty Russell wrote: >> On Fri, 29 May 2009 01:45:27 pm john cooper wrote: >>> virtio_blk-serial-4.patch >> Hate to ask dumb questions, but is there a scsi equivalent of this? It'd be >> nice if we could avoid being ATA-specific in the long run... > > SCSI has mode pages, where ATA pretty much stuffs everything into the > identify data. > >> Also, why u16? > > The identify page is word based, so u16 makes sense. It is actually an artifact left over from the previous version. In that case the driver was only pulling the serial number over, itself constructing a mocked-up identify page, and needed to be aware of the internal structure. Currently qemu fabricates the identify page which the driver treats as opaque data passed onto the user. So the u16 * structure has no meaning. Sorry to be late in responding here. A patch to address this wrinkle and other feedback to follow shortly. -john >>> +/* return ATA identify data >>> + */ >>> +static int virtblk_identify(struct gendisk *disk, void *argp) >>> +{ >>> + struct virtio_blk *vblk = disk->private_data; >>> + u16 *id; >>> + int err = -ENOMEM; >>> + >>> + id = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL); >>> + if (!id) >>> + goto out; >>> + >>> + err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, >>> + offsetof(struct virtio_blk_config, identify), id, >>> + VIRTIO_BLK_ID_BYTES); > -- john.cooper@redhat.com