Skip to content

Commit

Permalink
[PATCH] v9fs: zero copy implementation
Browse files Browse the repository at this point in the history
Performance enhancement reducing the number of copies in the data and
stat paths.

Signed-off-by: Latchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Latchesar Ionkov authored and Linus Torvalds committed Jan 9, 2006
1 parent d8da097 commit 531b109
Show file tree
Hide file tree
Showing 18 changed files with 1,083 additions and 1,047 deletions.
302 changes: 176 additions & 126 deletions fs/9p/9p.c

Large diffs are not rendered by default.

75 changes: 54 additions & 21 deletions fs/9p/9p.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* 9P protocol definitions.
*
* Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
* Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
* Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
*
Expand Down Expand Up @@ -102,10 +103,16 @@ enum {

#define V9FS_NOTAG (u16)(~0)
#define V9FS_NOFID (u32)(~0)
#define V9FS_MAXWELEM 16

/* ample room for Twrite/Rread header (iounit) */
#define V9FS_IOHDRSZ 24

struct v9fs_str {
u16 len;
char *str;
};

/* qids are the unique ID for a file (like an inode */
struct v9fs_qid {
u8 type;
Expand All @@ -115,6 +122,29 @@ struct v9fs_qid {

/* Plan 9 file metadata (stat) structure */
struct v9fs_stat {
u16 size;
u16 type;
u32 dev;
struct v9fs_qid qid;
u32 mode;
u32 atime;
u32 mtime;
u64 length;
struct v9fs_str name;
struct v9fs_str uid;
struct v9fs_str gid;
struct v9fs_str muid;
struct v9fs_str extension; /* 9p2000.u extensions */
u32 n_uid; /* 9p2000.u extensions */
u32 n_gid; /* 9p2000.u extensions */
u32 n_muid; /* 9p2000.u extensions */
};

/* file metadata (stat) structure used to create Twstat message
The is similar to v9fs_stat, but the strings don't point to
the same memory block and should be freed separately
*/
struct v9fs_wstat {
u16 size;
u16 type;
u32 dev;
Expand All @@ -131,38 +161,37 @@ struct v9fs_stat {
u32 n_uid; /* 9p2000.u extensions */
u32 n_gid; /* 9p2000.u extensions */
u32 n_muid; /* 9p2000.u extensions */
char data[0];
};

/* Structures for Protocol Operations */

struct Tversion {
u32 msize;
char *version;
struct v9fs_str version;
};

struct Rversion {
u32 msize;
char *version;
struct v9fs_str version;
};

struct Tauth {
u32 afid;
char *uname;
char *aname;
struct v9fs_str uname;
struct v9fs_str aname;
};

struct Rauth {
struct v9fs_qid qid;
};

struct Rerror {
char *error;
struct v9fs_str error;
u32 errno; /* 9p2000.u extension */
};

struct Tflush {
u32 oldtag;
u16 oldtag;
};

struct Rflush {
Expand All @@ -171,8 +200,8 @@ struct Rflush {
struct Tattach {
u32 fid;
u32 afid;
char *uname;
char *aname;
struct v9fs_str uname;
struct v9fs_str aname;
};

struct Rattach {
Expand All @@ -182,13 +211,13 @@ struct Rattach {
struct Twalk {
u32 fid;
u32 newfid;
u32 nwname;
char **wnames;
u16 nwname;
struct v9fs_str wnames[16];
};

struct Rwalk {
u32 nwqid;
struct v9fs_qid *wqids;
u16 nwqid;
struct v9fs_qid wqids[16];
};

struct Topen {
Expand All @@ -203,7 +232,7 @@ struct Ropen {

struct Tcreate {
u32 fid;
char *name;
struct v9fs_str name;
u32 perm;
u8 mode;
};
Expand Down Expand Up @@ -254,12 +283,12 @@ struct Tstat {
};

struct Rstat {
struct v9fs_stat *stat;
struct v9fs_stat stat;
};

struct Twstat {
u32 fid;
struct v9fs_stat *stat;
struct v9fs_stat stat;
};

struct Rwstat {
Expand All @@ -274,6 +303,7 @@ struct v9fs_fcall {
u32 size;
u8 id;
u16 tag;
void *sdata;

union {
struct Tversion tversion;
Expand Down Expand Up @@ -306,10 +336,12 @@ struct v9fs_fcall {
} params;
};

#define V9FS_FCALLHDRSZ (sizeof(struct v9fs_fcall) + \
sizeof(struct v9fs_stat) + 16*sizeof(struct v9fs_qid) + 16)
#define PRINT_FCALL_ERROR(s, fcall) dprintk(DEBUG_ERROR, "%s: %.*s\n", s, \
fcall?fcall->params.rerror.error.len:0, \
fcall?fcall->params.rerror.error.str:"");

#define FCALL_ERROR(fcall) (fcall ? fcall->params.rerror.error : "")
char *v9fs_str_copy(char *buf, int buflen, struct v9fs_str *str);
int v9fs_str_compare(char *buf, struct v9fs_str *str);

int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize,
char *version, struct v9fs_fcall **rcall);
Expand All @@ -325,7 +357,7 @@ int v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid,
struct v9fs_fcall **rcall);

int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid,
struct v9fs_stat *stat, struct v9fs_fcall **rcall);
struct v9fs_wstat *wstat, struct v9fs_fcall **rcall);

int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid,
char *name, struct v9fs_fcall **rcall);
Expand All @@ -343,4 +375,5 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid,
u64 offset, u32 count, struct v9fs_fcall **rcall);

int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
u32 count, void *data, struct v9fs_fcall **rcall);
u32 count, const char __user * data,
struct v9fs_fcall **rcall);
10 changes: 5 additions & 5 deletions fs/9p/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
obj-$(CONFIG_9P_FS) := 9p2000.o

9p2000-objs := \
trans_fd.o \
trans_sock.o \
mux.o \
9p.o \
conv.o \
vfs_super.o \
vfs_inode.o \
vfs_file.o \
vfs_dir.o \
vfs_dentry.o \
error.o \
mux.o \
trans_fd.o \
trans_sock.o \
9p.o \
conv.o \
v9fs.o \
fid.o

Loading

0 comments on commit 531b109

Please sign in to comment.