fs/9p: Update zero-copy implementation in 9p
Subsystems (3)
PATCH 1/1 fs/9p: Update zero-copy implementation in 9p
* remove lot of update to different data structure
* add a seperate callback for zero copy request.
* above makes non zero copy code path simpler
* remove conditionalizing TREAD/TREADDIR/TWRITE in the zero copy path
* Fix the dotu p9_check_errors with zero copy. Add sufficient doc around
* Add support for both in and output buffers in zero copy callback
* pin and unpin pages in the same context
* use helpers instead of defining page offset and rest of page ourself
* Fix mem leak in p9_check_errors
* Remove 'E' and 'F' in p9pdu_vwritef
Signed-off-by Aneesh Kumar K.V <[email protected]>
--- fs/9p/vfs_dir.c | 2 +- include/net/9p/9p.h | 11 +- include/net/9p/transport.h | 10 +- net/9p/client.c | 391 ++++++++++++++++++++++++++++++++----------- net/9p/protocol.c | 46 +----- net/9p/protocol.h | 1 + net/9p/trans_common.c | 53 ++----- net/9p/trans_common.h | 21 +-- net/9p/trans_virtio.c | 317 +++++++++++++++++++++--------------- 9 files changed, 506 insertions(+), 346 deletions(-)
fs/9p/vfs_dir.c +1 -1
@@ -231,7 +231,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,while (err ==0 ) {if (rdir->tail == rdir->head) { err =p9_client_readdir (fid, rdir->buf, buflen, - filp->f_pos); + filp->f_pos);if (err <=0 ) goto unlock_and_exit;
include/net/9p/9p.h +3 -8
@@ -354,6 +354,9 @@ enum p9_qid_t {/* Room for readdir header */ #define P9_READDIRHDRSZ 24 +/* size of header for zero copy read/write */ +#define P9_ZC_HDR_SZ 4096 +/** * struct p9_qid - file system entity information * @type: 8-bit type &p9_qid_t
@@ -550,10 +553,6 @@ struct p9_rstatfs {* @tag: transaction id of the request * @offset: used by marshalling routines to track current position in buffer * @capacity: used by marshalling routines to track total malloc'd capacity -* @pubuf: Payload user buffer given by the caller -* @pkbuf: Payload kernel buffer given by the caller -* @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write. -* @private: For transport layer's use. * @sdata: payload * * &p9_fcall represents the structure for all 9P RPC
@@ -570,10 +569,6 @@ struct p9_fcall {size_t offset;size_t capacity; -char __user *pubuf; -char *pkbuf; -size_t pbuf_size; -void *private;u8 *sdata; };
include/net/9p/transport.h +2 -8
@@ -26,13 +26,6 @@#ifndef NET_9P_TRANSPORT_H #define NET_9P_TRANSPORT_H -#define P9_TRANS_PREF_PAYLOAD_MASK 0x1 - -/* Default. Add Payload to PDU before sending it down to transport layer */ -#define P9_TRANS_PREF_PAYLOAD_DEF 0x0 -/* Send pay load separately to transport layer along with PDU.*/ -#define P9_TRANS_PREF_PAYLOAD_SEP 0x1 -/** * struct p9_trans_module - transport module interface * @list: used to maintain a list of currently available transports
@@ -56,13 +49,14 @@ struct p9_trans_module {struct list_head list;char *name;/* name of transport */ int maxsize;/* max message size of transport */ -int pref;/* Preferences of this transport */ int def;/* this transport should be default */ struct module *owner;int (*create)(struct p9_client *,const char *,char *);void (*close) (struct p9_client *);int (*request) (struct p9_client *,struct p9_req_t *req);int (*cancel) (struct p9_client *,struct p9_req_t *req); +int (*zc_request)(struct p9_client *,struct p9_req_t *, +char *,char *,int ,int ,int ,int ); };void v9fs_register_trans (struct p9_trans_module *m);
net/9p/client.c +291 -100
552 lines not on this page · raw message
net/9p/protocol.c +1 -45
70 lines not on this page · raw message
net/9p/protocol.h +1 -0
@@ -32,3 +32,4 @@ int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type);int p9pdu_finalize (struct p9_fcall *pdu);void p9pdu_dump (int ,struct p9_fcall *);void p9pdu_reset (struct p9_fcall *pdu); +size_t pdu_read (struct p9_fcall *pdu,void *data,size_t size);
net/9p/trans_common.c +15 -38
80 lines not on this page · raw message
net/9p/trans_common.h +3 -18
@@ -12,21 +12,6 @@* */ -/* TRUE if it is user context */ -#define P9_IS_USER_CONTEXT (!segment_eq(get_fs(), KERNEL_DS)) - -/** -* struct trans_rpage_info - To store mapped page information in PDU. -* @rp_alloc:Set if this structure is allocd, not a reuse unused space in pdu. -* @rp_nr_pages: Number of mapped pages -* @rp_data: Array of page pointers -*/ -struct trans_rpage_info { -u8 rp_alloc; -int rp_nr_pages; -struct page *rp_data[0 ]; -}; - -void p9_release_req_pages (struct trans_rpage_info *); -int p9_payload_gup (struct p9_req_t *,size_t *,int *,int ,u8 ); -int p9_nr_pages (struct p9_req_t *); +void p9_release_pages (struct page **,int ); +int p9_payload_gup (char *,int *,struct page **,int ); +int p9_nr_pages (char *,int );
net/9p/trans_virtio.c +189 -128
403 lines not on this page · raw message
Signature · 1 line
1.7.4.1