From mboxrd@z Thu Jan 1 00:00:00 1970 From: Latchesar Ionkov Subject: Re: [V9fs-developer] [PATCH 3/5] [net/9p] Add support for placing page addresses directly on the sg list. Date: Thu, 19 Aug 2010 12:49:20 -0600 Message-ID: References: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com> <1282066045-3945-4-git-send-email-jvrao@linux.vnet.ibm.com> <4C6D77EA.7060609@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, Badari Pulavarty To: "Venkateswararao Jujjuri (JV)" Return-path: Received: from mail-yw0-f46.google.com ([209.85.213.46]:49309 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751566Ab0HSStV convert rfc822-to-8bit (ORCPT ); Thu, 19 Aug 2010 14:49:21 -0400 Received: by ywe9 with SMTP id 9so223871ywe.19 for ; Thu, 19 Aug 2010 11:49:21 -0700 (PDT) In-Reply-To: <4C6D77EA.7060609@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: It is kind of strange that part of the fcall packet (everything other than the Rread/Twrite data) is located in a buffer pointed by sdata, and the rest is in pages pointed by pdata. A scatterlist would make it tidier and easier to figure out what is where. Thanks, Lucho On Thu, Aug 19, 2010 at 12:28 PM, Venkateswararao Jujjuri (JV) wrote: > Latchesar Ionkov wrote: >> Is there any particular reason p9_fcall to have pointers to pages >> instead of a scatterlist? > > Given that page sizes are constant, all we need is offset into the fi= rst page. > IO size determines the last page. So we decided no need to put sg lis= t in the > p9_fcall. > > Thanks, > JV > >> >> Thanks, >> =A0 =A0 Lucho >> >> On Tue, Aug 17, 2010 at 11:27 AM, Venkateswararao Jujjuri (JV) >> wrote: >>> This patch adds necessary infrastructure for placing page addresses >>> directly on the sg list for the server to consume. >>> >>> The newly added routine pack_sg_list_p() is just like pack_sg_list(= ) >>> except that it takes page array as an input and directly places the= m on >>> the sg list after taking care of the first page offset. >>> >>> Signed-off-by: Venkateswararao Jujjuri >>> Signed-off-by: Badari Pulavarty >>> --- >>> =A0include/net/9p/9p.h =A0 | =A0 =A06 ++++- >>> =A0net/9p/client.c =A0 =A0 =A0 | =A0 =A04 +++ >>> =A0net/9p/trans_virtio.c | =A0 59 +++++++++++++++++++++++++++++++++= +++++++++++++-- >>> =A03 files changed, 65 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h >>> index a8de812..382ef22 100644 >>> --- a/include/net/9p/9p.h >>> +++ b/include/net/9p/9p.h >>> @@ -651,7 +651,11 @@ struct p9_fcall { >>> >>> =A0 =A0 =A0 =A0size_t offset; >>> =A0 =A0 =A0 =A0size_t capacity; >>> - >>> + =A0 =A0 =A0 struct page **pdata; >>> + =A0 =A0 =A0 uint32_t pdata_mapped_pages; >>> + =A0 =A0 =A0 uint32_t pdata_off; >>> + =A0 =A0 =A0 uint32_t pdata_write_len; >>> + =A0 =A0 =A0 uint32_t pdata_read_len; >>> =A0 =A0 =A0 =A0uint8_t *sdata; >>> =A0}; >>> >>> diff --git a/net/9p/client.c b/net/9p/client.c >>> index 29bbbbd..5487896 100644 >>> --- a/net/9p/client.c >>> +++ b/net/9p/client.c >>> @@ -244,8 +244,12 @@ static struct p9_req_t *p9_tag_alloc(struct p9= _client *c, u16 tag) >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0req->tc->sdata =3D (char *) req->tc = + sizeof(struct p9_fcall); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0req->tc->capacity =3D c->msize; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->tc->pdata_write_len =3D 0; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->tc->pdata_read_len =3D 0; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0req->rc->sdata =3D (char *) req->rc = + sizeof(struct p9_fcall); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0req->rc->capacity =3D c->msize; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->rc->pdata_write_len =3D 0; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->rc->pdata_read_len =3D 0; >>> =A0 =A0 =A0 =A0} >>> >>> =A0 =A0 =A0 =A0p9pdu_reset(req->tc); >>> diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c >>> index 762c19f..8f86cb5 100644 >>> --- a/net/9p/trans_virtio.c >>> +++ b/net/9p/trans_virtio.c >>> @@ -180,6 +180,44 @@ pack_sg_list(struct scatterlist *sg, int start= , int limit, char *data, >>> =A0 =A0 =A0 =A0return index-start; >>> =A0} >>> >>> +/** >>> + * pack_sg_list_p - Pack a scatter gather list from an array of pa= ges. >>> + * @sg: scatter/gather list to pack into >>> + * @start: which segment of the sg_list to start at >>> + * @limit: maximum segment to pack data to >>> + * @pdu: pdu prepared to put on the wire. >>> + * @count: amount of data to pack into the scatter/gather list >>> + * >>> + * This is just like pack_sg_list() except that it takes page arra= y >>> + * as an input and directly places them on the sg list after takin= g >>> + * care of the first page offset. >>> + */ >>> + >>> +static int >>> +pack_sg_list_p(struct scatterlist *sg, int start, int limit, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct p9_fcall *pdu, int count) >>> +{ >>> + =A0 =A0 =A0 int s; >>> + =A0 =A0 =A0 int i =3D 0; >>> + =A0 =A0 =A0 int index =3D start; >>> + >>> + =A0 =A0 =A0 if (pdu->pdata_off) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 s =3D min((int)(PAGE_SIZE - pdu->pdat= a_off), count); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sg_set_page(&sg[index++], pdu->pdata[= i++], s, pdu->pdata_off); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 count -=3D s; >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 while (count) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(index > limit); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 s =3D min((int)PAGE_SIZE, count); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sg_set_page(&sg[index++], pdu->pdata[= i++], s, 0); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 count -=3D s; >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 return index-start; >>> +} >>> + >>> + >>> =A0/* We don't currently allow canceling of virtio requests */ >>> =A0static int p9_virtio_cancel(struct p9_client *client, struct p9_= req_t *req) >>> =A0{ >>> @@ -196,16 +234,31 @@ static int p9_virtio_cancel(struct p9_client = *client, struct p9_req_t *req) >>> =A0static int >>> =A0p9_virtio_request(struct p9_client *client, struct p9_req_t *req= ) >>> =A0{ >>> - =A0 =A0 =A0 int in, out; >>> + =A0 =A0 =A0 int in, out, outp, inp; >>> =A0 =A0 =A0 =A0struct virtio_chan *chan =3D client->trans; >>> =A0 =A0 =A0 =A0char *rdata =3D (char *)req->rc+sizeof(struct p9_fca= ll); >>> >>> =A0 =A0 =A0 =A0P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request= \n"); >>> >>> =A0 =A0 =A0 =A0out =3D pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, req= ->tc->sdata, >>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->tc->size)= ; >>> - =A0 =A0 =A0 in =3D pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out,= rdata, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->tc->size); >>> + >>> + =A0 =A0 =A0 BUG_ON(req->tc->pdata_write_len && req->tc->pdata_rea= d_len); >>> + >>> + =A0 =A0 =A0 if (req->tc->pdata_write_len) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 outp =3D pack_sg_list_p(chan->sg, out= , VIRTQUEUE_NUM, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 req->tc, req->tc->pdata_write_len); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 out +=3D outp; >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 if (req->tc->pdata_read_len) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 inp =3D pack_sg_list(chan->sg, out, V= IRTQUEUE_NUM, rdata, 11); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 in =3D pack_sg_list_p(chan->sg, out+i= np, VIRTQUEUE_NUM, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 req->tc, req->tc->pdata_read_len); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 in +=3D inp; >>> + =A0 =A0 =A0 } else { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 in =3D pack_sg_list(chan->sg, out, VI= RTQUEUE_NUM, rdata, >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0client->msi= ze); >>> + =A0 =A0 =A0 } >>> >>> =A0 =A0 =A0 =A0req->status =3D REQ_STATUS_SENT; >>> >>> -- >>> 1.6.5.2 >>> >>> >>> -------------------------------------------------------------------= ----------- >>> This SF.net email is sponsored by >>> >>> Make an app they can't live without >>> Enter the BlackBerry Developer Challenge >>> http://p.sf.net/sfu/RIM-dev2dev >>> _______________________________________________ >>> V9fs-developer mailing list >>> V9fs-developer@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/v9fs-developer >>> > > > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html