From mboxrd@z Thu Jan 1 00:00:00 1970 From: Latchesar Ionkov Subject: Re: [V9fs-developer] [RFC] [PATCH 2/7] [net/9p] Adds supporting functions for zero copy. Date: Tue, 8 Feb 2011 08:20:47 -0700 Message-ID: References: <1297063283-2180-1-git-send-email-jvrao@linux.vnet.ibm.com> <1297063283-2180-3-git-send-email-jvrao@linux.vnet.ibm.com> <4D4F9780.1050507@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, v9fs-developer@lists.sourceforge.net To: "Venkateswararao Jujjuri (JV)" Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:35765 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753860Ab1BHPUs convert rfc822-to-8bit (ORCPT ); Tue, 8 Feb 2011 10:20:48 -0500 Received: by gxk9 with SMTP id 9so2254129gxk.19 for ; Tue, 08 Feb 2011 07:20:48 -0800 (PST) In-Reply-To: <4D4F9780.1050507@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Can you please rename the common structures so they don't have virtio related names? Thanks, Lucho On Sun, Feb 6, 2011 at 11:56 PM, Venkateswararao Jujjuri (JV) wrote: > On 2/6/2011 11:21 PM, Venkateswararao Jujjuri (JV) wrote: >> Signed-off-by: Venkateswararao Jujjuri >> --- >> =A0net/9p/Makefile =A0 =A0 =A0 | =A0 =A01 + >> =A0net/9p/trans_common.c | =A0 88 ++++++++++++++++++++++++++++++++++= +++++++++++++++ >> =A0net/9p/trans_common.h | =A0 26 ++++++++++++++ >> =A03 files changed, 115 insertions(+), 0 deletions(-) >> =A0create mode 100644 net/9p/trans_common.c >> =A0create mode 100644 net/9p/trans_common.h >> >> diff --git a/net/9p/Makefile b/net/9p/Makefile >> index 198a640..a0874cc 100644 >> --- a/net/9p/Makefile >> +++ b/net/9p/Makefile >> @@ -9,6 +9,7 @@ obj-$(CONFIG_NET_9P_RDMA) +=3D 9pnet_rdma.o >> =A0 =A0 =A0 util.o \ >> =A0 =A0 =A0 protocol.o \ >> =A0 =A0 =A0 trans_fd.o \ >> + =A0 =A0 trans_common.o \ >> >> =A09pnet_virtio-objs :=3D \ >> =A0 =A0 =A0 trans_virtio.o \ >> diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c >> new file mode 100644 >> index 0000000..dad57d2 >> --- /dev/null >> +++ b/net/9p/trans_common.c >> @@ -0,0 +1,88 @@ >> +/* >> + * Copyright IBM Corporation, 2010 >> + * Author Venkateswararao Jujjuri >> + * >> + * This program is free software; you can redistribute it and/or mo= dify it >> + * under the terms of version 2.1 of the GNU Lesser General Public = License >> + * as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it would be useful,= but >> + * WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> + * >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include "trans_common.h" >> + >> +/** >> + * =A0p9_release_req_pages - Release pages after the transaction. >> + * =A0@*private: PDU's private page of type virtio_rpage_info_t >> + */ >> +void >> +p9_release_req_pages(void *private) >> +{ >> + =A0 =A0 virtio_rpage_info_t *vpinfo =3D private; >> + =A0 =A0 int i =3D 0; >> + >> + =A0 =A0 while (vpinfo->vp_data[i] && vpinfo->vp_nr_pages--) { >> + =A0 =A0 =A0 =A0 =A0 =A0 put_page(vpinfo->vp_data[i]); >> + =A0 =A0 =A0 =A0 =A0 =A0 i++; >> + =A0 =A0 } >> +} >> + >> +/** >> + * payload_gup - Calculates number of pages that needs to be pinned= and >> + * pins them ehter for read/write through get_user_pages_fast(). >> + */ >> +int >> +payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len= , u8 rw) >> +{ >> + =A0 =A0 int nr_pages; >> + =A0 =A0 uint32_t first_page_bytes =3D 0; >> + =A0 =A0 uint32_t pdata_mapped_pages; >> + =A0 =A0 virtio_rpage_info_t =A0*rpinfo; >> + >> + =A0 =A0 nr_pages =3D req->tc->pbuf_size >> PAGE_SHIFT; >> + =A0 =A0 *pdata_off =3D (size_t)req->tc->pbuf & (PAGE_SIZE-1); >> + >> + =A0 =A0 if (*pdata_off) >> + =A0 =A0 =A0 =A0 =A0 =A0 first_page_bytes =3D min((PAGE_SIZE - *pda= ta_off), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 req->tc->p= buf_size); >> + >> + =A0 =A0 if (req->tc->pbuf_size - (first_page_bytes + (nr_pages << = PAGE_SHIFT))){ >> + =A0 =A0 =A0 =A0 =A0 =A0 /* trailing partial page */ >> + =A0 =A0 =A0 =A0 =A0 =A0 nr_pages++; >> + =A0 =A0 } >> + =A0 =A0 if (first_page_bytes) { >> + =A0 =A0 =A0 =A0 =A0 =A0 /* leading partial page */ >> + =A0 =A0 =A0 =A0 =A0 =A0 nr_pages++; >> + =A0 =A0 } >> + =A0 =A0 /* TODO: Use buffer on PDU instead of allocating */ >> + =A0 =A0 rpinfo =3D kmalloc(sizeof(virtio_rpage_info_t) + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sizeof(struct page *) * nr= _pages, GFP_KERNEL); >> + =A0 =A0 req->tc->private =3D (void *)rpinfo; >> + =A0 =A0 pdata_mapped_pages =3D get_user_pages_fast((unsigned long)= req->tc->pbuf, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nr_pages, rw, &rpinfo->vp_= data[0]); >> + >> + =A0 =A0 if (pdata_mapped_pages < 0) { >> + =A0 =A0 =A0 =A0 =A0 =A0 printk("get_user_pages_fast failed:%d udat= a:%p" "nr_pages:%d\n", >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pdata_mapp= ed_pages, req->tc->pbuf, nr_pages); >> + =A0 =A0 =A0 =A0 =A0 =A0 pdata_mapped_pages =3D 0; >> + =A0 =A0 =A0 =A0 =A0 =A0 kfree(rpinfo); >> + =A0 =A0 =A0 =A0 =A0 =A0 return -EIO; >> + =A0 =A0 } >> + =A0 =A0 rpinfo->vp_nr_pages =3D pdata_mapped_pages; >> + =A0 =A0 if (*pdata_off) { >> + =A0 =A0 =A0 =A0 =A0 =A0 *pdata_len =3D first_page_bytes; >> + =A0 =A0 =A0 =A0 =A0 =A0 *pdata_len +=3D min((req->tc->pbuf_size - = *pdata_len), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((size_t)p= data_mapped_pages - 1) << PAGE_SHIFT); >> + =A0 =A0 } else { >> + =A0 =A0 =A0 =A0 =A0 =A0 *pdata_len =3D min (req->tc->pbuf_size, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (size_t)pd= ata_mapped_pages << PAGE_SHIFT); >> + =A0 =A0 } >> + =A0 =A0 return 0; >> +} >> diff --git a/net/9p/trans_common.h b/net/9p/trans_common.h >> new file mode 100644 >> index 0000000..8c85392 >> --- /dev/null >> +++ b/net/9p/trans_common.h >> @@ -0,0 +1,26 @@ >> +/* >> + * Copyright IBM Corporation, 2010 >> + * Author Venkateswararao Jujjuri >> + * >> + * This program is free software; you can redistribute it and/or mo= dify it >> + * under the terms of version 2.1 of the GNU Lesser General Public = License >> + * as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it would be useful,= but >> + * WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> + * >> + */ >> + >> +/** >> + * struct virtio_rpage_info - To store mapped page information in P= DU. >> + * @vp_nr_pages: Number of mapped pages >> + * @vp_data: Array of page pointers >> + */ >> +typedef struct virtio_rpage_info { >> + =A0 =A0 =A0 int vp_nr_pages; >> + =A0 =A0 =A0 struct page *vp_data[0]; >> +} virtio_rpage_info_t; >> + >> +void p9_release_req_pages(void *); >> +int payload_gup(struct p9_req_t *, size_t *, int *, u8); > > > > ---------------------------------------------------------------------= --------- > The modern datacenter depends on network connectivity to access resou= rces > and provide services. The best practices for maximizing a physical se= rver's > connectivity to a physical network are well understood - see how thes= e > rules translate into the virtual world? > http://p.sf.net/sfu/oracle-sfdevnlfb > _______________________________________________ > 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