From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH RFC 3/3] Virtio draft III: example block driver Date: Mon, 18 Jun 2007 12:09:09 +0300 Message-ID: <46764BB5.6070704@qumranet.com> References: <1181217762.14054.192.camel@localhost.localdomain> <1181999552.6237.255.camel@localhost.localdomain> <1181999669.6237.257.camel@localhost.localdomain> <1181999825.6237.260.camel@localhost.localdomain> <1181999920.6237.263.camel@localhost.localdomain> <46754451.2010305@qumranet.com> <1182154095.19064.24.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Stephen Rothwell , Xen Mailing List , "jmk-zzFmDc4TPjtKvsKVC3L/VUEOCMrvLtNR@public.gmane.org" , kvm-devel , virtualization , Christian Borntraeger , Latchesar Ionkov , Suzanne McIntosh , Jens Axboe , Martin Schwidefsky To: Rusty Russell Return-path: In-Reply-To: <1182154095.19064.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Rusty Russell wrote: > On Sun, 2007-06-17 at 17:25 +0300, Avi Kivity wrote: > >> Rusty Russell wrote: >> >>> + /* Set up for reply. */ >>> + vblk->sg[0].page = virt_to_page(&vbr->in_hdr); >>> + vblk->sg[0].offset = offset_in_page(&vbr->in_hdr); >>> + vblk->sg[0].length = sizeof(vbr->in_hdr); >>> + num = blk_rq_map_sg(q, vbr->req, vblk->sg+1); >>> + vbr->out_hdr.id = vblk->vdev->ops->add_inbuf(vblk->vdev, vblk->sg, >>> + 1+num, vbr); >>> + if (IS_ERR_VALUE(vbr->out_hdr.id)) >>> + goto full; >>> + >>> + vblk->sg[0].page = virt_to_page(&vbr->out_hdr); >>> + vblk->sg[0].offset = offset_in_page(&vbr->out_hdr); >>> + vblk->sg[0].length = sizeof(vbr->out_hdr); >>> + >>> + vbr->out_id = vblk->vdev->ops->add_outbuf(vblk->vdev, vblk->sg, 1, >>> + vbr); >>> >> This strikes me as wasteful. Why not set up a single descriptor which >> contains both placement and the data itself? >> > > We could actually do this for write, but not for read (where the length > & sector need to be sent to other end, and the data comes from other > end). > > So you map the first sg entry for output, and the rest for input. Less pretty, but more efficient. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/