Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116250
b: refs/heads/master
c: fbedadc
h: refs/heads/master
v: v3
  • Loading branch information
Eric Van Hensbergen committed Oct 17, 2008
1 parent da1f38d commit 1de3b28
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0fc9655ec67ec5d4dfd08e469e0e9f0a494bf5bc
refs/heads/master: fbedadc16e5c888e4df9df3b1757de4993508d35
2 changes: 1 addition & 1 deletion trunk/fs/9p/v9fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
if (!v9ses->clnt->dotu)
v9ses->flags &= ~V9FS_EXTENDED;

v9ses->maxdata = v9ses->clnt->msize;
v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ;

/* for legacy mode, fall back to V9FS_ACCESS_ANY */
if (!v9fs_extended(v9ses) &&
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/9p/v9fs_vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ int v9fs_file_open(struct inode *inode, struct file *file);
void v9fs_inode2stat(struct inode *inode, struct p9_stat *stat);
void v9fs_dentry_release(struct dentry *);
int v9fs_uflags2omode(int uflags, int extended);

ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64);
5 changes: 1 addition & 4 deletions trunk/fs/9p/vfs_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include "v9fs.h"
#include "v9fs_vfs.h"
#include "fid.h"

/**
* v9fs_vfs_readpage - read an entire page in from 9P
Expand All @@ -53,14 +52,12 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page)
int retval;
loff_t offset;
char *buffer;
struct p9_fid *fid;

P9_DPRINTK(P9_DEBUG_VFS, "\n");
fid = filp->private_data;
buffer = kmap(page);
offset = page_offset(page);

retval = p9_client_readn(fid, buffer, offset, PAGE_CACHE_SIZE);
retval = v9fs_file_readn(filp, buffer, NULL, offset, PAGE_CACHE_SIZE);
if (retval < 0)
goto done;

Expand Down
57 changes: 53 additions & 4 deletions trunk/fs/9p/vfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,72 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
}

/**
* v9fs_file_read - read from a file
* v9fs_file_readn - read from a file
* @filp: file pointer to read
* @data: data buffer to read data into
* @udata: user data buffer to read data into
* @count: size of buffer
* @offset: offset at which to read data
*
*/

ssize_t
v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
u64 offset)
{
int n, total;
struct p9_fid *fid = filp->private_data;

P9_DPRINTK(P9_DEBUG_9P, "fid %d offset %llu count %d\n", fid->fid,
(long long unsigned) offset, count);

n = 0;
total = 0;
do {
n = p9_client_read(fid, data, udata, offset, count);
if (n <= 0)
break;

if (data)
data += n;
if (udata)
udata += n;

offset += n;
count -= n;
total += n;
} while (count > 0 && n == (fid->clnt->msize - P9_IOHDRSZ));

if (n < 0)
total = n;

return total;
}

/**
* v9fs_file_read - read from a file
* @filp: file pointer to read
* @udata: user data buffer to read data into
* @count: size of buffer
* @offset: offset at which to read data
*
*/

static ssize_t
v9fs_file_read(struct file *filp, char __user * data, size_t count,
v9fs_file_read(struct file *filp, char __user *udata, size_t count,
loff_t * offset)
{
int ret;
struct p9_fid *fid;

P9_DPRINTK(P9_DEBUG_VFS, "\n");
P9_DPRINTK(P9_DEBUG_VFS, "count %d offset %lld\n", count, *offset);
fid = filp->private_data;
ret = p9_client_read(fid, NULL, data, *offset, count);

if (count > (fid->clnt->msize - P9_IOHDRSZ))
ret = v9fs_file_readn(filp, NULL, udata, count, *offset);
else
ret = p9_client_read(fid, NULL, udata, *offset, count);

if (ret > 0)
*offset += ret;

Expand Down
1 change: 0 additions & 1 deletion trunk/include/net/9p/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ int p9_client_clunk(struct p9_fid *fid);
int p9_client_remove(struct p9_fid *fid);
int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
u64 offset, u32 count);
int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count);
int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
u64 offset, u32 count);
struct p9_stat *p9_client_stat(struct p9_fid *fid);
Expand Down
26 changes: 0 additions & 26 deletions trunk/net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,32 +1150,6 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
}
EXPORT_SYMBOL(p9_client_write);

int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count)
{
int n, total;

P9_DPRINTK(P9_DEBUG_9P, "fid %d offset %llu count %d\n", fid->fid,
(long long unsigned) offset, count);
n = 0;
total = 0;
while (count) {
n = p9_client_read(fid, data, NULL, offset, count);
if (n <= 0)
break;

data += n;
offset += n;
count -= n;
total += n;
}

if (n < 0)
total = n;

return total;
}
EXPORT_SYMBOL(p9_client_readn);

static struct p9_stat *p9_clone_stat(struct p9_stat *st, int dotu)
{
int n;
Expand Down

0 comments on commit 1de3b28

Please sign in to comment.